wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Link internal frame to menu item" Watch "Link internal frame to menu item" New topic

Link internal frame to menu item

John Jai

Joined: May 31, 2011
Posts: 1776
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

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

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

I agree. Here's the link: http://aspose.com/file-tools
subject: Link internal frame to menu item
Similar Threads
JInternalFrames and focus
Opening JInternalFrame on JMenu selection
MDI with a Windows menu
JDesktopPane spawning Internal Frames
Internal Frame