ModernJava
http://www.modernminds.com
B uttonBarObserver Interface

In order for your applet or application to find out about button events for a ButtonBar, an object (which can be your applet or application) must implement the ButtonBarObserver interface and register itself with the ButtonBar using the ButtonBar method addButtonObserver.

The ButtonBarObserver interface defines one method that must be implemented:

public void buttonBarEvent(ButtonBar barID, String buttonID, int buttonEvent)

The above method is called by a ButtonBar for each registered observer whenever a ButtonBar event occurs. The following describes what data is passed to the observer by the ButtonBar for the event:
barID

This is the ButtonBar object for which the event occurred.

If you are using multiple ButtonBars in your Java program, this parameter will allow you to identify the ButtonBar that generated the event.
buttonID

This String is the buttonID of the ButtonRegion object for which the event occurred.

The buttonID is assigned when the ButtonRegion is created.

If the event is a
ButtonBar.IMAGES_READY event, then this parameter will be null.
buttonEvent

This parameter is a int constant that describes the ButtonBar event that occurred. The valid values are:
  • ButtonBar.IMAGES_READY (1)

    This event indicates that images for all button states have been generated. In a situation where you do not want a user to use the buttons until all of the images are ready, this would be the time to enable the ButtonBar.

  • ButtonBar.MOUSE_CLICK (2)

    This event is generated when the mouse is clicked over an enabled button.

  • ButtonBar.MOUSE_CLICK_DISABLED (4)

    This event is generated when the mouse is clicked over a disabled button.

  • ButtonBar.BUTTON_UP (8)

    This event is generated when the mouse button is clicked and released over a button causing it to change from a BUTTON_DOWN state to a BUTTON_UP state. This event is only generated for "sticky" buttons.

  • ButtonBar.BUTTON_DOWN (16)

    When a button's state changes from BUTTON_UP to BUTTON.DOWN, this event is generated. Note that this event is different from a MOUSE_CLICK event. The MOUSE_CLICK event means that the mouse was clicked on the button, but the mouse could have been moved off of the button before the mouse button was released (in effect canceling the click). The BUTTON.DOWN event means that the mouse button was clicked and released while over a button.

  • ButtonBar.MOUSE_ENTER (32)

    This event occurs when the mouse is moved within the boundaries of an enabled button.

  • ButtonBar.MOUSE_ENTER_DISABLED (64)

    This event occurs when the mouse is moved within the boundaries of a disabled button.

  • ButtonBar.MOUSE_EXIT (128)

    This event occurs when the mouse is moved from within the boundaries of an enabled button to a location outside of the boundaries of the button.

  • ButtonBar.MOUSE_EXIT_DISABLED (256)

    This event occurs when the mouse is moved from within the boundaries of a disabled button to a location outside of the boundaries of the button.

Copyright © 1997 by Modern Minds, Inc.