简体   繁体   中英

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)

使用卡片布局并正确执行。您可以在此处学习如何使用卡片布局

尝试调用revalidate()方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM