• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMenuBar & JInternalFrame  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jmenubar mb, jmenu m, jmenuitem mi, jdesktoppane dtp, jinternalframe inf. the menuitem is attached to menu which is attached to menubar which is attached to desktoppane. I want to open a jinternalframe from the actionPerformed event of the jmenuitem.
My question is how do I get hold of the desktop instance attached to the menubar so that I can say
desktoppane.add(jinternalframe) ;
inside the actionPerformedEvent of the JMenuBar.
Please help ..
Thanks,
Raja
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
if you're instantiating the JMenu inside of the JFrame the JDesktopPane is attached to, than you can make the desktopPane a class variable. or there sure is a method for JFrame like getDesktopPane() (but does that return the right instance?? i don't know). you cannot use "this" inside the ActionListener. refer to it as "TheNameOfYourClass.this". a cass variable or a final variable respactively can be referenced as it is.
chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!