JXTA

net.jxta.widget
Class ButtonTemplate

java.lang.Object
  |
  +--java.awt.Component
        |
        +--net.jxta.widget.ButtonTemplate
Direct Known Subclasses:
ImageButton, TabButton

public abstract class ButtonTemplate
extends java.awt.Component

A button. This class only implements the methods needed to dispatch and catch the Action events. All painting has to be done in the derived classes

See Also:
Serialized Form

Field Summary
protected  java.awt.event.ActionListener actionListener
          The actionListener to which to post action events generated by this button
protected  java.lang.String label
          The text of the button
protected  boolean pressed
          Is the button currently pressed
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ButtonTemplate()
          Constructs a ButtonTemplate.
ButtonTemplate(java.lang.String label)
          Constructs a TabButton with the specified label.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds the specified action listener to receive action events from this button.
 boolean contains(int x, int y)
          Determine if click was inside tab button.
 java.lang.String getLabel()
          gets the label
 void processMouseEvent(java.awt.event.MouseEvent e)
          Paints the button and distribute an action event to all listeners.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes the specified action listener so it no longer receives action events from this button.
 void setLabel(java.lang.String label)
          sets the tab label
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionListener

protected java.awt.event.ActionListener actionListener
The actionListener to which to post action events generated by this button

pressed

protected boolean pressed
Is the button currently pressed

label

protected java.lang.String label
The text of the button
Constructor Detail

ButtonTemplate

public ButtonTemplate()
Constructs a ButtonTemplate.

ButtonTemplate

public ButtonTemplate(java.lang.String label)
Constructs a TabButton with the specified label.
Parameters:
label - the label of the button
Method Detail

getLabel

public java.lang.String getLabel()
gets the label
See Also:
setLabel

setLabel

public void setLabel(java.lang.String label)
sets the tab label
See Also:
getLabel

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener to receive action events from this button.
Parameters:
listener - the action listener

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener so it no longer receives action events from this button.
Parameters:
listener - the action listener

contains

public boolean contains(int x,
                        int y)
Determine if click was inside tab button.
Overrides:
contains in class java.awt.Component

processMouseEvent

public void processMouseEvent(java.awt.event.MouseEvent e)
Paints the button and distribute an action event to all listeners.
Overrides:
processMouseEvent in class java.awt.Component

JXTA