If the original project creates a JFrame, you can just get the JPrame contentPane through
Container contentPane = myFrame.getContentPane();
And then add the JApplet as its contentPane, but you will lose the menu, etc.
For instance,
public class MyApplet extends JApplet { @Override public void init() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { JFrame myFrame = new MyFrame("Frame"); Container contentPane = myFrame.getContentPane(); setContentPane(contentPane); } }); } catch (InterruptedException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }
It is better to have most of your GUI classes designed to create get go JPanels, so you don't come across this limitation.
source share