Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

JFrame in JApplet

lijinshyamlijinshyam Posts: 1Member
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

  • Josh CodeJosh Code Posts: 675Member
    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.