ShR
ShR

Reputation: 3

How to load Jpanel in a Jframe using button click (Netbeans)

I'm using netbeans IDE and I created a Jframe with two Jpanels one is for Jbuttons and other one is for load another Jpanels to it when clicks those buttons. I tried to do it from buttonclick action.

Jpanel2 j2=new Jpanel2(); JPanel1.add(j2); j2.setVisible(True);

but this code is not working. I want to know how can I do this. (I think this is also same as loading JinternelFrames)

Upvotes: 0

Views: 2752

Answers (2)

Muzaffer
Muzaffer

Reputation: 1457

Try to call revalidate() method.

Upvotes: 1

Sanjaya Liyanage
Sanjaya Liyanage

Reputation: 4746

Use a card layout and do it correctly.You can learn how to use card layout here

Upvotes: 1

Related Questions