JFrame in JApplet

Hi all,
I am new to JApplet. I am trying to add a JFrame in to the JApplet contentpnae using

getContentpane().add(frame);

It throw exception. So how can i add the JFrame or frame in to Applet


Thanks

Comments

  • You can't add a JFrame to a JApplet. The closest thing to using other windows in an applet is that you can pop up messages in dialog windows using for example, JOptionPane.showMessageDialog.

    Applets are limited for security reasons. If you are trying to reuse code intended for use in a JFrame, try binding your code to JPanel.
    This way, you can add the JPanel to your JFrame for your application.
    You can also add the JPanel to the JApplet for the applet version.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion