Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to show a jpanel from an applet

Rafael AnschauFeb 25 2011 — edited Feb 27 2011
Hi, I am trying t make an applet instanciate and setVisible(true) a Jpannel. When I write:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
 
        //a jpanel
        teste3 t=new teste3();

        t.setVisible(true);
}
It doesn´t show t, if t is a jpanel. If it´s a Jframe it does, but when it closes, the applet closes as well(netbeans sets
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
which you can only edit by hacking).

Thanks,

Rafael

Edited by: Rafael Anschau on 27/02/2011 08:06

Edited by: Rafael Anschau on 27/02/2011 08:07
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 27 2011
Added on Feb 25 2011
4 comments
264 views