This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Link internal frame to menu item Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Link internal frame to menu item" Watch "Link internal frame to menu item" New topic
Author

Link internal frame to menu item

John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Hi,
Could you please suggest me how to link the internal frames to menu item in swing? There is an existing application that has a base Frame and the internal frames are added to its JDesktopPane. I need to create a new menu bar that will have opened Internal frames (basically different small applications) in its menu item. When i click a particular menu item, the particular internal frame should come in front of others. Any suggestion will be of much help. Thanks!
Ashutosh M Kulkarni
Ranch Hand

Joined: Jun 07, 2010
Posts: 41

All you need to do is write an actionPerofrmed() method for your menu.
You will easily the find the syntax if you SearchFirst for it :-)


SCJP 6, next stop - OCPJWCD!
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Hi Ashutosh,
Thanks for your reply. I will try that. When i create a JInternalFrame i pass the desktop pane assigned as the content pane to the main JFrame. Once an internal frame is created (note that internal frames create many internal frames from their code) i need to add that internal frame name as a menu item to the main menu created with the JFrame. Suppose if the user opens a same application (with same name obviously!) the menu item should be like "LoginScreen1", "LoginScreen2" & "LoginScreen3" preferably with a tick mark against the currently active JinternalFrame. When user switches between them the current internal frame goes back & the chosen one comes into focus.
Thanks for your suggestion
And one more when i searched the forum with "Link internal frame to menu item" i got zero results might be i searched on a wrong context!
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Hi Ashutosh - i was able to accomplish the logic using actionPerformed() method. thanks for your suggestion.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Link internal frame to menu item