This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.



Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JMenuBar  RSS feed

 
AKEEL MALIK
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Someone please help me, i've created a menubar with menuitems in a JFrame but i dont no how to do it in a JApplet. I would appreciate anybody's help.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Mr. Automatic Weapon,

Welcome to JavaRanch!

First, a bit of business: our naming policy requires that you use a real first and last name, not a "handle", for your display name. If you could head over here and fix that for me, I'd be much obliged. Thanks.

Now, as to your question: you're wanting a menu bar to show up right on the browser window? I don't think you can do that. Your applet can create a JFrame, though, and that JFrame can have a menu bar, of course.

But what do I know, anyway. Let's move this question over to the Swing forum and let the experts have a look.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java.awt.Applet class does not support menus. To add menus in an Applet you can add them to a Panel and add the Panel to the Applet. The javax.swing.JApplet class has a setJMenuBar method, just like JFrame. The way to find out is to look at the api for the class you are interested in. In the JApplet api in the Method Summary section you find the setJMenuBar method. Farther down is the section Methods inherited from class java.awt.Applet which shows Applet methods that are inherited, and therefore available for use, by JApplet.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!