    All Packages    This Package    Previous    Next

# Class awt.Button

    java.lang.Object
       |
       +----awt.Component
               |
               +----awt.Button

public class Button
extends Component
implements ChoiceHandler

A class that produces a native Gui button. This button will respond to callbacks supplied by its subclass. For example, this button will print hello when pressed:

    class HelloButton extends Button {
         public HelloButton(String l, String n, Window p) {
    		super(l, n, p);
    	}
    	public void selected(Component c, int pos) {
    		System.out.println("Hello");
    	}
    }
     HelloButton b = new HelloButton("Press Me", "", window);

Version:
  1.21 03 Feb 1995
Author:
  Sami Shaio

##

label
  The string label for this button.
normalImage
  The image label for this button when inactive.
pressedImage
  The image label for this button when pressed.

##

Button(String, String, Container)
  Constructs a Button with a string label.
Button(String, String, Window)
  Constructs a button given a Window as a parent rather than a container.
Button(Image, Image, String, Container)
  Constructs an image Button.
Button(Image, Image, String, Window)
  Constructs a button given a Window as a parent rather than a container.

##

dispose()
  Disposes of this button.
doubleClick(Component, int)
  Unused method.
map()
  Shows this button.
move(int, int)
  Moves this button to the given x and y coordinates.
reshape(int, int, int, int)
  Reshapes this button.
selected(Component, int)
  This method is invoked when the button has been selected.
unMap()
  Hides this button.

##

label

      public String label

  The string label for this button.

normalImage

      public Image normalImage

  The image label for this button when inactive.

pressedImage

      public Image pressedImage

  The image label for this button when pressed.

##

Button

      public Button(String pLabel,
                    String pName,
                    Container pParent)

  Constructs a Button with a string label.
  Parameters:
    pLabel - the string label for the button
    pName - the name of the button, this name may be used by the layout algorithm in pParent.
    pParent - the parent window in which to put the button.

Button

      public Button(String pLabel,
                    String pName,
                    Window pParent)

  Constructs a button given a Window as a parent rather than a container. This is here for backward-compatibility with alpha1.

Button

      public Button(Image normalImage,
                    Image pressedImage,
                    String pName,
                    Container pParent)

  Constructs an image Button.
  Parameters:
    normalImage - the image to display when the button is inactive.
    pressedImage - the image to display when the button is pressed. This may be null.
    pName - the name of the button, this name may be used by the layout algorithm in pParent.
    pParent - the parent window in which to put the button.
  See Also:
    Image, GifImage

Button

      public Button(Image normalImage,
                    Image pressedImage,
                    String pName,
                    Window pParent)

  Constructs a button given a Window as a parent rather than a container. This is here for backward-compatibility with alpha1.

##

doubleClick

      public void doubleClick(Component c,
                              int pos)

  Unused method. It is required by the ChoiceHandler interface.

selected

      public void selected(Component c,
                           int pos)

  This method is invoked when the button has been selected. Override this method in a subclass to do something useful.
  Parameters:
    c - is the component being selected. This is useful if another object handles the method for this button.
    pos - is undefined in this context.

move

      public void move(int X,
                       int Y)

  Moves this button to the given x and y coordinates.
  Overrides:
    move in class Component

reshape

      public void reshape(int x,
                          int y,
                          int w,
                          int h)

  Reshapes this button.
  Overrides:
    reshape in class Component

dispose

      public void dispose()

  Disposes of this button. The button cannot be used after being disposed.
  Overrides:
    dispose in class Component

map

      public void map()

  Shows this button.
  Overrides:
    map in class Component

unMap

      public void unMap()

  Hides this button.
  Overrides:
    unMap in class Component

    All Packages    This Package    Previous    Next