File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Invisible Jpanels with jmenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Invisible Jpanels with jmenu" Watch "Invisible Jpanels with jmenu" New topic

Invisible Jpanels with jmenu

Ilo Nato

Joined: Oct 16, 2009
Posts: 6

I am in need of help here.
I making a aplication that are using menus.
Every jMenuItem you click will get you a new jpanel with its items (buttons, labels).

From what i have read i should be using Actionevent thing.
But i cant make it work.

Here is the code (part of the code).

That was the actionlistener i tried.

That was my jpanels.
You will get contentPane first when you open the application. And when you click one of the menus you will get the Jpanel that is for that menu.
If you guys help me to get to make the contantpane invis and make the other visible, it would be great. I couldnt do it (have worked on it 8< hour (i am new to java)).

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10815

Welcome to the Ranch.

Do I understand you correctly, that based on the menu selection, you want to display only specific components and hide the rest?
If yes, then check out card layout

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ilo Nato

Joined: Oct 16, 2009
Posts: 6
Thanks Maneesh,

I found a cardlayout example on net. It looks like the one have to use. I am gona try it out.

I agree. Here's the link:
subject: Invisible Jpanels with jmenu
It's not a secret anymore!