vipratech.beans.standardbeans
Class MainButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--vipratech.awt.VCanvas
                    |
                    +--vipratech.beans.standardbeans.MainButton

public class MainButton
extends VCanvas

The MainButton class displays a flat button that responds to mouse over and mouse pressed events by changing its 3D appearance.

Icons can be added from vipratech.awt.ButtonIcon that also respond to these events.

The button can be wired to vipratech.beans.LanguageChoice at design time to display a locale senstive label.

By setting the boolean clickable variable to true, the button becomes toggled so that it stays recessed when clicked once and then snaps back to its normal enabled appearance after a second mouse release.

On mouse release the button generates an action event object which is sent to any registered action listeners.

Version:
1.06, March 2001
Author:
Warwick Bailey   warwick-bailey@bigfoot.com
See Also:
MainButtonIcon, Serialized Form

Fields inherited from class vipratech.awt.VCanvas
fm
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
MainButton()
          Constructor.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Allows this component to be wired at design time with action listeners
 boolean getClickable()
          Returns the boolean state of the clickable variable.
 boolean getClickedOnce()
          Returns true if the button has been set to clickable and the button is in the recessed clicked once position.
 boolean getEnabled()
          Returns the enabled state of the button.
 int getIcon()
          Gets the int constant resprenting the icon.
 java.lang.String getKey()
          Returns the key for the button.
 java.lang.String getLabel()
          Returns the string representing the label.
 java.util.Locale getLocale()
          Returns the locale for this component.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of this component of width 56px, height 36px.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this component of width 56px, height 36px.
 void paint(java.awt.Graphics g)
          Draws the complete button, border and icon depending on the current mouse event.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Allows this component to be wired up to vipratech.beans.LanguageChoice at design time.
 void removeActionListener(java.awt.event.ActionListener listener)
          Allows this component to be un-wired at design time with action listeners
 void setClickable(boolean clickable)
          Allows the button to be set to clickable.
 void setEnabled(boolean enabled)
          Allows the button to be disabled.
 void setIcon(int icon)
          Sets the icon for the button using an int constant from vipratech.awt.ButtonIcon.
 void setKey(java.lang.String key)
          Sets a key for the button.
 void setLabel(java.lang.String label)
          Sets the label for the button.
 void setLocale(java.util.Locale locale)
          Sets the locale for this component.
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, 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, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFont, setForeground, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MainButton

public MainButton()
Constructor.
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Allows this component to be wired at design time with action listeners

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Allows this component to be un-wired at design time with action listeners

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Allows this component to be wired up to vipratech.beans.LanguageChoice at design time.

paint

public final void paint(java.awt.Graphics g)
Draws the complete button, border and icon depending on the current mouse event.
Overrides:
paint in class java.awt.Canvas

getMinimumSize

public final java.awt.Dimension getMinimumSize()
Returns the minimum size of this component of width 56px, height 36px.
Overrides:
getMinimumSize in class java.awt.Component

getPreferredSize

public final java.awt.Dimension getPreferredSize()
Returns the preferred size of this component of width 56px, height 36px.
Overrides:
getPreferredSize in class java.awt.Component

setEnabled

public final void setEnabled(boolean enabled)
Allows the button to be disabled. The button is enabled by default.
Overrides:
setEnabled in class java.awt.Component

getEnabled

public final boolean getEnabled()
Returns the enabled state of the button.

setClickable

public final void setClickable(boolean clickable)
Allows the button to be set to clickable. The button can then be clicked once to be recessed and then clicked a second time to return to the enabled state.

getClickable

public final boolean getClickable()
Returns the boolean state of the clickable variable.

getClickedOnce

public final boolean getClickedOnce()
Returns true if the button has been set to clickable and the button is in the recessed clicked once position.

setIcon

public final void setIcon(int icon)
Sets the icon for the button using an int constant from vipratech.awt.ButtonIcon. Possible values are ICON_START, ICON_STOP, ICON_RESET, ICON_PAUSE, ICON_SAVE, ICON_EDIT, ICON_INFO, ICON_WIZARD, ICON_PROTOKOLL and ICON_SEND.

getIcon

public final int getIcon()
Gets the int constant resprenting the icon.

setLabel

public final void setLabel(java.lang.String label)
Sets the label for the button.

getLabel

public final java.lang.String getLabel()
Returns the string representing the label.

setKey

public final void setKey(java.lang.String key)
Sets a key for the button. The key is used to extract a locale specific label from a key/value pair in a resource bundle.

getKey

public final java.lang.String getKey()
Returns the key for the button. The key is used to extract a locale specific label from a key/value pair in a resource bundle.

setLocale

public final void setLocale(java.util.Locale locale)
Sets the locale for this component.
Overrides:
setLocale in class java.awt.Component

getLocale

public final java.util.Locale getLocale()
Returns the locale for this component.
Overrides:
getLocale in class java.awt.Component

dathe@chemie.uni-leipzig.de"

http://leipzig.vernetztes-studium.de