Class awt.Button
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.23 29 Mar 1995
-
Author:
-
Sami Shaio
-
disabledImage
-
The image for this button when disabled.
-
enabled
-
Is this button enabled?
-
label
-
The string label for this button.
-
normalImage
-
The image for this button when inactive.
-
pressedImage
-
The image 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, Image, String, Container)
-
Constructs an image Button.
-
Button(Image, Image, String, Container)
-
Constructs an image button with no disabled version.
-
Button(Image, Image, String, Window)
-
Constructs a button given a Window as a parent rather than a
container.
-
disable()
-
Disables this button.
-
dispose()
-
Disposes of this button.
-
doubleClick(Component, int)
-
Unused method.
-
enable()
-
Enables this button.
-
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 for this button when inactive.
disabledImage
public Image disabledImage
-
The image for this button when disabled.
pressedImage
public Image pressedImage
-
The image for this button when pressed.
enabled
public boolean enabled
-
Is this button enabled?
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,
Image disabledImage,
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.
-
disabledImage
-
the image to display when the button is disabled.
-
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,
Container pParent)
-
Constructs an image button with no disabled version. Provided
for backward compatibility.
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
enable
public void enable()
-
Enables this button.
disable
public void disable()
-
Disables this button.
All Packages This Package Previous Next