java.awt
Class Button
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Button
- public class Button
- extends Component
|
Constructor Summary |
Button()
Constructs a new button without label |
Button(String s)
Constructs a new button with the given label |
| Methods inherited from class java.awt.Component |
addKeyListener,
addMouseListener,
addMouseMotionListener,
contains,
findComponentAt,
getBackground,
getBounds,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getLocationOnScreen,
getMaximumSize,
getMinimumSize,
getParent,
getPreferredSize,
getSize,
getWidth,
getX,
getY,
hasFocus,
invalidate,
isEnabled,
isFocusTraversable,
isValid,
isVisible,
paintAll,
processKeyEvent,
repaint,
repaint,
requestFocus,
setBackground,
setBounds,
setEnabled,
setForeground,
setLocation,
setSize,
setSize,
setVisible,
update,
validate |
Button
public Button()
- Constructs a new button without label
Button
public Button(String s)
- Constructs a new button with the given label
addActionListener
public void addActionListener(ActionListener al)
- Adds an action listener to the button. The listener will be notified
when the button is "pressed". Attention: kAWT supports only
a single action listener for each button
paint
public void paint(Graphics g)
- Draws the button on the given graphics context.
- Overrides:
- paint in class Component
processMouseEvent
public void processMouseEvent(MouseEvent me)
- Processes the given mouse event.
- Overrides:
- processMouseEvent in class Component
removeActionListener
public void removeActionListener(ActionListener al)
- Removes the given action listener.
setActionCommand
public void setActionCommand(String s)
- Sets the action command for action events to the given
string. The default action command string is the label of the
button.
setLabel
public void setLabel(String s)
- Sets the label of the button. The button will be
repainted automatically as soon as the event handling
routine returns.