*
The moose likes Swing / AWT / SWT and the fly likes On click on menuitem jPanel is not displayed but it will be displayed after minimizing the app. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "On click on menuitem jPanel is not displayed but it will be displayed after minimizing the app." Watch "On click on menuitem jPanel is not displayed but it will be displayed after minimizing the app." New topic
Author

On click on menuitem jPanel is not displayed but it will be displayed after minimizing the app.

ishan dave
Ranch Hand

Joined: Apr 16, 2007
Posts: 39
Hi All,

Currently I am developing an application where I have a menubar with menuitems.

For example
Customer
Create New
Edit
View

Vehicle
Add New
Update

now for this application I have a jFrame(This is the main container of my application) and have 5 jPanel corresponding to every menuitem i.e. CreateNewCustomerPanel, EditCustomerPanel, ViewCustomerPanel etc

and what try to achieve is on click of the menuitem want to show the corresponding panel. so for that following is my code



Now when I run my application and click on "Create New" menuitem nothing is being shown but if I minimize the application and maximize it again it'll show me the new jPanel i.e. createCustomer. It should load at the time of menuitem click.

Can any one please help to solve this that how can I manage to open createNewCustomerPanel on the first time click on the button only.

Thank you very much in advance.

Thank you,
Ishan
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10354
    
    8

1) After you add/remove the panels, call revalidate and repaint on the container
2) User CardLayout


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ishan dave
Ranch Hand

Joined: Apr 16, 2007
Posts: 39
Hi Maneesh,

Thank you very much for your reply.

With best regards,
Ishan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: On click on menuitem jPanel is not displayed but it will be displayed after minimizing the app.