java.awt
Class Button
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Button
- All Implemented Interfaces:
- ImageObserver
- public class Button
- extends Component
|
Constructor Summary |
Button()
Constructs a new button without label |
Button(java.lang.String s)
Constructs a new button with the given label |
| Methods inherited from class java.awt.Component |
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, contains, enableEvents, findComponentAt, getBackground, getBounds, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getLocationOnScreen, getMaximumSize, getParent, getPreferredSize, getSize, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isFocusTraversable, isValid, isVisible, paintAll, processEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, repaint, repaint, requestFocus, setBackground, setBounds, setEnabled, setFont, setForeground, setLocation, setSize, setSize, setVisible, update, validate |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Button
public Button()
- Constructs a new button without label
Button
public Button(java.lang.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
dispatchEvent
public void dispatchEvent(AWTEvent event)
- Overrides:
dispatchEvent in class Component
removeActionListener
public void removeActionListener(ActionListener al)
- Removes the given action listener.
setActionCommand
public void setActionCommand(java.lang.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(java.lang.String s)
- Sets the label of the button. The button will be
repainted automatically as soon as the event handling
routine returns.
getMinimumSize
public Dimension getMinimumSize()
- Overrides:
getMinimumSize in class Component