|
MenuDemo: Using Menus in your Applet
MenuDemo
Easily implement your own menu bars for your Java applet!
This is a demo that uses my MenuPanel class...
- Normally, Menu bars are only allowed in Java Frame windows, but not
allowed directly in your applet's Panel.
- This class allows you to add a menu to any Container object, including the
applet's Panel.
- You don't need special APIs like the MS AFC or Sun JFC
classes. Just my MenuPanel class
and a Java 1.1 compiler.
Notes about using the
MenuPanel class...
- It appears that
MenuShortcuts do not work through MenuPanel as an
applet. This is likely due to Java applet model
restrictions. The shortcuts do work when you use MenuPanel in stand-alone Java
applications, but not in applets.
- CheckboxMenuItem events
are not caught by the
ActionListener interface. Use ItemListener to
check for those if you need to.
- You need to include your
MenuPanel container inside a Panel or other container in order
for it to function properly, then add the Panel to your applet. If you add
the MenuPanel directly
to the applet's layout manager, it won't recieve events
properly.
New for version 1.1 of the MenuPanel class:
(4-1-2000) * Added a 3D bar on the left to make it look more
like a Win98 menu bar. * Added support for custom colors or fonts to
the menu bar.
The
MenuPanel class (v1.0) was written by Bruce
Stone and is a production of Stonerware Enterprises, (c)
1997-2000.
You can download a copy of the applet and source code, and are
free to modify it, as long as you follow the included disclaimer.
Download your copy of my MenuDemo applet and MenuPanel class source code
right here. Enjoy it!
Want to see other applets and samples made using the MenuPanel
class? Check out JavaCraft, MenuLynx and
the demo of my HVRule
class.
|