Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMenuBar on the move

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an applet,
FotoCube
When it is first loaded, the File and Options menu are on the left of the menu bar.

When the applet is reloaded, they slide across to the centre of the JMenuBar, and reloading again makes them slide again.

Currently, I don't have any code in the init() method, and all the Menu stuff is done in the JApplet's constructor.

Is this were I'm going wrong, or perhaps I need a start() method, but I'm not sure how that works.

Thanks
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applet methods are called by the AppletContext/Appletviewer.
init is called on startup and only once. It is the place to put/initiate your construction code. start is called each time the applet is restored and is used for starting animation threads which are better left off when the applet is not active. This is considered well-mannered behavior.
When running the applet from the command line (with optional main method) you will have to make other arrangements to call the start and stop methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic