java.awt
Class Button
- Accessible, ImageObserver, MenuContainer, Serializable
This class provides a button widget for the AWT.
Button() - Initializes a new instance of
Button with no label.
|
Button(String label) - Initializes a new instance of
Button with the specified
label.
|
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , addNotify , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , bounds , checkImage , checkImage , coalesceEvents , contains , contains , createImage , createImage , createVolatileImage , createVolatileImage , deliverEvent , disable , disableEvents , dispatchEvent , doLayout , enable , enable , enableEvents , enableInputMethods , extends EventListener> T[] getListeners , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getAccessibleContext , getAlignmentX , getAlignmentY , getBackground , getBounds , getBounds , getColorModel , getComponentAt , getComponentAt , getComponentListeners , getComponentOrientation , getCursor , getDropTarget , getFocusCycleRootAncestor , getFocusListeners , getFocusTraversalKeys , getFocusTraversalKeysEnabled , getFont , getFontMetrics , getForeground , getGraphics , getGraphicsConfiguration , getHeight , getHierarchyBoundsListeners , getHierarchyListeners , getIgnoreRepaint , getInputContext , getInputMethodListeners , getInputMethodRequests , getKeyListeners , getLocale , getLocation , getLocation , getLocationOnScreen , getMaximumSize , getMinimumSize , getMouseListeners , getMouseMotionListeners , getMousePosition , getMouseWheelListeners , getName , getParent , getPeer , getPreferredSize , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getSize , getToolkit , getTreeLock , getWidth , getX , getY , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , invalidate , isBackgroundSet , isCursorSet , isDisplayable , isDoubleBuffered , isEnabled , isFocusCycleRoot , isFocusOwner , isFocusTraversable , isFocusable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isOpaque , isPreferredSizeSet , isShowing , isValid , isVisible , keyDown , keyUp , layout , list , list , list , list , list , locate , location , lostFocus , minimumSize , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paint , paintAll , paramString , postEvent , preferredSize , prepareImage , prepareImage , print , printAll , processComponentEvent , processEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processKeyEvent , processMouseEvent , processMouseMotionEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removeNotify , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , repaint , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , reshape , resize , resize , setBackground , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setEnabled , setFocusTraversalKeys , setFocusTraversalKeysEnabled , setFocusable , setFont , setForeground , setIgnoreRepaint , setLocale , setLocation , setLocation , setMaximumSize , setMinimumSize , setName , setPreferredSize , setSize , setSize , setVisible , show , show , size , toString , transferFocus , transferFocusBackward , transferFocusUpCycle , update , validate |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Button
public Button()
Initializes a new instance of Button
with no label.
Button
public Button(String label)
Initializes a new instance of Button
with the specified
label. The action command name is also initialized to this value.
label
- The label to display on the button.
addActionListener
public void addActionListener(ActionListener listener)
Adds a new entry to the list of listeners that will receive
action events from this button.
listener
- The listener to add.
extends EventListener> T[] getListeners
public extends EventListener> T[] getListeners(Class listenerType)
Returns all registered EventListers of the given listenerType.
listenerType must be a subclass of EventListener, or a
ClassClassException is thrown.
- extends EventListener> T[] getListeners in interface Component
listenerType
- the listener type to return
ClassCastException
- If listenerType doesn't specify a class or
interface that implements @see java.util.EventListener.
getActionCommand
public String getActionCommand()
Returns the action command name for this button.
- The action command name for this button.
getLabel
public String getLabel()
Returns the label for this button.
- The label for this button.
processActionEvent
protected void processActionEvent(ActionEvent event)
This method dispatches an action event for this button to any
registered listeners.
event
- The event to process.
processEvent
protected void processEvent(AWTEvent event)
Processes an event for this button. If the specified event is an
instance of ActionEvent
, then the
processActionEvent()
method is called to dispatch it
to any registered listeners. Otherwise, the superclass method
will be invoked. Note that this method will not be called at all
unless ActionEvent
's are enabled. This will be done
implicitly if any listeners are added.
- processEvent in interface Component
event
- The event to process.
removeActionListener
public void removeActionListener(ActionListener listener)
Removes the specified listener from the list of listeners that will
receive action events from this button.
listener
- The listener to remove.
setActionCommand
public void setActionCommand(String actionCommand)
Sets the action command name for this button to the specified value.
actionCommand
- The new action command name.
setLabel
public void setLabel(String label)
Sets the label for this button to the specified value.
label
- The new label for this button.
Button.java -- AWT button widget
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.