Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

menubars in applets.

 
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: 9370
11
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!
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!