Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class Button  view Button download Button.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Button
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, MenuContainer, java.io.Serializable

public class Button
extends Component
implements java.io.Serializable, javax.accessibility.Accessible

This class provides a button widget for the AWT.


Nested Class Summary
protected  class Button.AccessibleAWTButton
           
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener
 
Field Summary
private  java.awt.event.ActionListener action_listeners
           
(package private)  java.lang.String actionCommand
           
(package private)  java.lang.String label
           
private static long next_button_number
           
private static long serialVersionUID
           
 
Fields inherited from class java.awt.Component
accessibleContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, changeSupport, componentListener, componentSerializedDataVersion, cursor, dropTarget, enabled, eventMask, focusable, focusListener, focusTraversalKeys, focusTraversalKeysEnabled, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyListener, ignoreRepaint, inputMethodListener, isFocusTraversableOverridden, isPacked, keyListener, LEFT_ALIGNMENT, locale, minSize, mouseListener, mouseMotionListener, mouseWheelListener, name, nameExplicitlySet, newEventsOnly, orientation, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, TOP_ALIGNMENT, treeLock, valid, visible, width, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Button()
          Initializes a new instance of Button with no label.
Button(java.lang.String label)
          Initializes a new instance of Button with the specified label.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds a new entry to the list of listeners that will receive action events from this button.
 void addNotify()
          Notifies this button that it should create its native peer object.
(package private)  void dispatchEventImpl(AWTEvent e)
          Implementation of dispatchEvent.
(package private)  java.lang.String generateName()
          Generate a unique name for this button.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this Button.
 java.lang.String getActionCommand()
          Returns the action command name for this button.
 java.awt.event.ActionListener[] getActionListeners()
          Returns all added ActionListener objects.
 java.lang.String getLabel()
          Returns the label for this button.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns all registered EventListers of the given listenerType.
private static long getUniqueLong()
           
protected  java.lang.String paramString()
          Returns a debugging string for this button.
protected  void processActionEvent(java.awt.event.ActionEvent event)
          This method dispatches an action event for this button to any registered listeners.
protected  void processEvent(AWTEvent event)
          Processes an event for this button.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes the specified listener from the list of listeners that will receive action events from this button.
 void setActionCommand(java.lang.String actionCommand)
          Sets the action command name for this button to the specified value.
 void setLabel(java.lang.String label)
          Sets the label for this button to the specified value.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, findNextFocusComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getGraphicsConfigurationImpl, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, 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, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, 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, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, 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, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

actionCommand

java.lang.String actionCommand

label

java.lang.String label

action_listeners

private transient java.awt.event.ActionListener action_listeners

next_button_number

private static transient long next_button_number
Constructor Detail

Button

public Button()
Initializes a new instance of Button with no label.


Button

public Button(java.lang.String label)
Initializes a new instance of Button with the specified label. The action command name is also initialized to this value.

Method Detail

getLabel

public java.lang.String getLabel()
Returns the label for this button.


setLabel

public void setLabel(java.lang.String label)
Sets the label for this button to the specified value.


getActionCommand

public java.lang.String getActionCommand()
Returns the action command name for this button.


setActionCommand

public void setActionCommand(java.lang.String actionCommand)
Sets the action command name for this button to the specified value.


addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds a new entry to the list of listeners that will receive action events from this button.


removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified listener from the list of listeners that will receive action events from this button.


getActionListeners

public java.awt.event.ActionListener[] getActionListeners()
Returns all added ActionListener objects.

Since:
1.4

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns all registered EventListers of the given listenerType. listenerType must be a subclass of EventListener, or a ClassClassException is thrown.

Overrides:
getListeners in class Component
Since:
1.3

addNotify

public void addNotify()
Notifies this button that it should create its native peer object.

Overrides:
addNotify in class Component

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.

Overrides:
processEvent in class Component

processActionEvent

protected void processActionEvent(java.awt.event.ActionEvent event)
This method dispatches an action event for this button to any registered listeners.


dispatchEventImpl

void dispatchEventImpl(AWTEvent e)
Description copied from class: Component
Implementation of dispatchEvent. Allows trusted package classes to dispatch additional events first. This implementation first translates e to an AWT 1.0 event and sends the result to Component.postEvent(java.awt.Event) 55 . If the AWT 1.0 event is not handled, and events of type e are enabled for this component, e is passed on to Component.processEvent(java.awt.AWTEvent) 55 .

Overrides:
dispatchEventImpl in class Component

paramString

protected java.lang.String paramString()
Returns a debugging string for this button.

Overrides:
paramString in class Component

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Button. The context is created, if necessary.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class Component

generateName

java.lang.String generateName()
Generate a unique name for this button.

Overrides:
generateName in class Component

getUniqueLong

private static long getUniqueLong()