Modern Java
http://www.modernminds.com
B uttonBar Public Methods

The methods listed below are public methods and may be called from a Java program that instantiates an object of ButtonBar.class.

Note: Constructors for ButtonBar.class are documented separately.
Method Detail Enable or Disable ButtonBar.

void enable(boolean enableBar)
Method Detail Add a ButtonRegion to the ButtonBar.

boolean addButton(ButtonRegion buttonToAdd)
Method Detail Signal that all ButtonRegions have been added to the ButtonBar.

void allButtonsDefined()
Method Detail Add an observer for the ButtonBar.

void addButtonObserver(Object observer)
Method Detail Remove an observer for the ButtonBar.

boolean removeButtonObserver(Object observer)
M ethod Detail
void enable(boolean enableBar)

This method is used to enable or disable all buttons on the ButtonBar.

If the method is called with enableBar equal to true, then all buttons (as defined by ButtonRegion objects) that are enabled will be enabled on the button bar. If a ButtonRegion is disabled, then the button will continue to be disabled on the ButtonBar until the ButtonRegion is specifically enabled.

If enableBar is false, then all buttons on the ButtonBar will be disabled.

Note that when a ButtonBar is created, it initially has a disabled state. This means that you must call enable(true) before the button bar can be used. If you enable the bar after adding your ButtonRegions to the ButtonBar, then the ButtonBar will become functional immediately, even though all of the button state images might not be loaded or prepared. If you do not want the ButtonBar used until all of the images are completely ready, then the best time to enable the ButtonBar is after a ButtonBarObserver has received an IMAGES_READY event.
boolean addButton(ButtonRegion buttonToAdd)

Buttons on a ButtonBar are defined by ButtonRegion objects. Typically, you will first create a ButtonBar object, then create a ButtonRegion object for each button on the ButtonBar and add each ButtonRegion to the ButtonBar using the addButton method.

The method returns a boolean value of true or false. A return value of true means that the ButtonRegion was successfully added to the ButtonBar. A return value of false means that the ButtonRegion could not be added to the ButtonBar either because the button defined by the ButtonRegion will not completely fit on the ButtonBar, or because the ButtonRegion being added already belongs to another ButtonBar.

If a value of false is returned by the method, then a description of why the ButtonRegion could not be added to the ButtonBar is written to System.out.
boolean allButtonsDefined()

It is necessary to call this method only if the value of the downShift constructor parameter was true when the ButtonBar was created. If the parameter value was false, then this method need not be called.

Due to the way that the class creates images of shifted buttons, the class must be assured that all of the ButtonRegions (that define buttons on the ButtonBar) have been added before it begins to generate the shifted images.

If you are using the downShift capability of the ButtonBar class, be sure to call this method after you have added all ButtonRegions to the ButtonBar. Failure to call this method will cause the ButtonBar to wait to create the mouseDown and mouseDownOver images, thus preventing the IMAGES_READY event message from ever being delivered.
void addButtonObserver (Object observer)

The ButtonBar class sends notification of button events to observers that implement the ButtonBarObserver interface and that register themselves as ButtonBar observers with the ButtonBar class.

This method is used to register an object as an observer for the ButtonBar. Note that while this method will register any object that is passed to it, an error will be generated (and logged to System.out) if the object is found not to implement the ButtonBarObserver interface when a ButtonBar event is generated.

See the documentation for the ButtonBarObserver class for information on ButtonBar events.
void removeButtonObserver(Object observer)

This method is used to remove a ButtonBarObserver that has been previously registered with the ButtonBar.

The method will return a boolean value of true or false. If a value of true is returned, then the observer will no longer receive ButtonBar events. If a value of false is returned, then the ButtonBar could not find the observer in its list of registered ButtonBarObservers.
Copyright © 1997 by Modern Minds, Inc.