Skip to Main Content

Java Programming

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!

NetBeans: Set JPanel from another class.

807606Apr 18 2007 — edited Apr 19 2007
New here, and reasonably new to Java, and been using NetBeans for about a week. What I'm looking to do is have one JFrame (created through NetBeans) that I can populate with JPanels created in different classes.

For example, I want to have a main window, and when a user selects a menu option, the screen repaints and displays the new panel.

I've created a JFrame with menubar called "Startpage" via the GUI Builder (the class contains nothing else but the NetBeans generated code).

Then, I've created a JPanel called "pnlSettings". What I want to do is by clicking the Settings menu option (which I've attached the actionlistener too) the pnlSettings JPanel will load in the Startpage JFrame. Eventually I will have about 20 different panels that will load when selected from the menubar.

Any help would be appreciated.

Thanks


-Blaise

BTW: Anybody else hate GUIs? The database was the easy part, and I can't figure out this, what I would imagine to be, easy question.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2007
Added on Apr 18 2007
14 comments
2,427 views