Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

menubars in applets.  RSS feed

 
tomas gussymurphy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know that to set the menubar in a java program you have to call setMenuBar, a method of Frame. I cannot seem to use frames in my applet (adding a window to a container). is there a work around?
thanks.
 
Joe Ess
Bartender
Posts: 9436
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JMenuBar is a JComponent so you can add it to a Container like any other Swing widget. Set your applet's layout to BorderLayout and add the menu to the north quadrant and it will look the same as it looks on a frame.
 
tomas gussymurphy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cool that worked a treat! cheers!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!