com.ccg.awt
Class TallButton

java.lang.Object
  extended by java.awt.Component
      extended by com.ccg.awt.TallButton
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
ImageButton

public class TallButton
extends Component

A lightweight three state button that can be set quite tall. This is a lightweight component which implements a three state button. The three visual states include:

You use this object in a fashion similar to a Button (in the future it may be more similar to a JButton object). You can register yourself to listen for events as you normally would. To customize this object, use the following methods:

setForeground
This method controls the color of the text on the button when it has not yet been pressed (similar to a Button).
setBackground
This method controls the color of the button when it has not been pressed (similar to a Button).
setButtonPressedColor(java.awt.Color)
This method controls the color of the button when it has been pressed in (it defaults to dark gray).
setTextPressedColor(java.awt.Color)
This method controls the color of the text when the button is depressed (its default value is null - which will cause it to use the same value as the foreground color).
setTextEchoOn(boolean)
Set this boolean value to true if you want the text label on the button to be drawn twice when the mouse enters the buttons area (in a different color typically to create a etched look).
setTextEchoColor(java.awt.Color)
If this is set to a non-null value, then the text will be drawn on the button twice (first with this color and slightly shifted). If you set this to black or white, it can create an "etched" look for the text when the user's mouse enters the area.
setButtonHeight(int)
Sets how tall the button will be drawn. This corresponds to the number of lines of beveled edges that will be drawn.
setMargin(int)
Sets how many pixels of space are desired around the text which is displayed on the button.
setSemiPush(int)
Sets how far the button should appear to "push" when the user's mouse enters the text area.

This class should be updated to allow button pressing via the keyboard (not sure at the moment if this is done by looking for ActionEvent or direct KeyEvent events.

Since:
1.0
Version:
$Revision: 1.11 $
Author:
$Author: pkb $
See Also:
TallButtonDemo.java, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int AROUND_TEXT
          Constant defining one of the focus modes supported.
static int INSIDE
          Constant defining one of the focus modes supported.
static int NONE
          Constant defining one of the focus modes supported.
static int OUTSIDE
          Constant defining one of the focus modes supported.
static int UNDERLINE_TEXT
          Constant defining one of the focus modes supported.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TallButton()
          Initializes object to a default state.
TallButton(String text, int height, int SemiPush, int margin, Color echoColor)
          Construct and initialize the object.
 
Method Summary
 void addActionListener(ActionListener l)
          Register to receive button press notification.
 Align getAlign()
          Get the Align object used to align the bounding box of the text
 int getButtonHeight()
          Get the height of the button.
 Color getButtonPressedColor()
          Get button color when the button is pressed
 Color getDisabledButtonColor()
          Get the color to use for buttons when the button is disabled.
 Color getDisabledTextColor()
          Get the color to use for text labels when the button is disabled.
 Color getFocusColor()
          Get the color to use to show button has focus.
 int getFocusMode()
          Get how the button should be "emphasized" when it has focus.
static String[] getFocusModeChoices()
          Get the default list of Strings used to specify focus modes.
 Insets getInsets()
          Get how much the component should be inset from edges.
 int getMargin()
          Get the amount of desired margin space around the text the button.
 Color getMouseOverColor()
          Get the color of the button when the mouse pointer is over it
 MultiLineText getMultiLineText()
          Get the MultiLineText object which has the text
 Dimension getPreferredSize()
          Computes the preferred size of the button.
 int getSemiPush()
          Get the semi depress value of the button.
 String getText()
          Get the text label which appears on the button.
 Color getTextEchoColor()
          Get the color used when echoing text to show user what button they are on.
 Color getTextEchoReleasedColor()
          Get the color used when echoing text on a button in a released state.
 Color getTextPressedColor()
          Get the color of the text when the button is pressed.
 boolean isEmphasized()
          Should the button be emphasized (is the mouse over it)?
 boolean isFocusTraversable()
          Indicate that component can be traversed using keyboard.
 boolean isPressed()
          Is the button currently "pressed" (being held down).
 boolean isTextEchoOn()
          Is text echoed (hightlighted) when button has focus?
 void paint(Graphics g)
          Paints the component on a graphics context.
 void paintInsets(Graphics g)
          Paints the "inset" border on a graphics context.
 void paintText(Graphics g)
          Paints the text component on a graphics context.
 void processEvent(AWTEvent e)
          Monitor for certain MOUSE/KEYBOARD events.
 void removeActionListener(ActionListener l)
          Deregister to receive button press notification.
 void set(TagLookup info)
          Set properties for button based on values in TagLookup table.
 void setAlign(Align val)
          Set the Align object used to align the bounding box of the text
 void setButtonHeight(int h)
          Set the height of the button.
 void setButtonPressedColor(Color val)
          Set button color when the button is pressed
 void setEnabled(boolean state)
          Set whether the button should be enabled or disabled.
 void setFocusColor(Color val)
          Set the color to use to show button has focus.
 void setFocusMode(int val)
          Set how the button should be "emphasized" when it has focus.
 void setInsets(Insets val)
          Set how much the component should be inset from edges This property controls how much clear area should exist at the edges of the component.
 void setMargin(int margin)
          Set the amount of margin space around text on top of the button.
 void setMouseOverColor(Color val)
          Set the color of the button when the mouse pointer is over it You can set this value to 'null' to force the mouse over color to match the "released" state of the button.
 void setMultiLineText(MultiLineText val)
          Set the MultiLineText object which has the text
 void setSemiPush(int v)
          Set the semi depressed value of the button.
 void setText(String text)
          Set the text label which appears on the button.
 void setTextEchoColor(Color c)
          Set the "echo" color when button has the focus.
 void setTextEchoOn(boolean val)
          Set text echoed (hightlighted) when button has focus.
 void setTextEchoReleasedColor(Color c)
          Set the "echo" color when button is released.
 void setTextPressedColor(Color c)
          Set the color of the text when the button is pressed.
 void update(Graphics g)
          Disable clearing of component area.
 
Methods inherited from class java.awt.Component
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, 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, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, 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, paintAll, paramString, 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, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Constant defining one of the focus modes supported.

Since:
1.0
See Also:
setFocusMode(int), Constant Field Values

OUTSIDE

public static final int OUTSIDE
Constant defining one of the focus modes supported.

Since:
1.0
See Also:
setFocusMode(int), Constant Field Values

INSIDE

public static final int INSIDE
Constant defining one of the focus modes supported.

Since:
1.0
See Also:
setFocusMode(int), Constant Field Values

AROUND_TEXT

public static final int AROUND_TEXT
Constant defining one of the focus modes supported.

Since:
1.0
See Also:
setFocusMode(int), Constant Field Values

UNDERLINE_TEXT

public static final int UNDERLINE_TEXT
Constant defining one of the focus modes supported.

Since:
1.0
See Also:
setFocusMode(int), Constant Field Values
Constructor Detail

TallButton

public TallButton()
Initializes object to a default state. After this type of construction, the component will be in its default state. You will most likely want to specify the text which appears on the button if you initialize it in this fashion.

Since:
1.0
See Also:
TallButton(String,int,int,int,Color)

TallButton

public TallButton(String text,
                  int height,
                  int SemiPush,
                  int margin,
                  Color echoColor)
Construct and initialize the object. This method allows one to construction as well as initialize many of the attributes associated with the object in one step.

Parameters:
text - The text label which will appear on the button.
height - The desired height of the button (set to -1 to leave it at the default setting).
semiDepress - How many pixel lines the button should appear to press down on focus (see setSemiPush(int) for details. Set to -1 to leave in its default state (must be less than height).
margin - How many pixels of space you would like as a minimum around the text which appears on the top of the button. Set to -1 to leave it at the default value.
echoColor - Pass a non-null color (like Color.white) if you want to enable text echoing when the cursor enters the component space. Pass null if you want to disable text echoing.
Since:
1.0
See Also:
TallButton()
Method Detail

set

public void set(TagLookup info)
         throws ParseException
Set properties for button based on values in TagLookup table. This method will set all of the properties it can find from the specified TagLookup table. The "keys" which we recognize are as follows:
text - setText(java.lang.String)
The text to be displayed, it may contain new line characters (such as "Hello\nWorld") for multiline text.
font - Component.setFont(java.awt.Font)
Used to set a specific font for the object. See TagLookup.getFont(java.lang.String, java.awt.Font) for details on specifying font strings.
height - setButtonHeight(int)
To set the button height (how tall it appears). This controls the number of pixels around the outside of the button used to draw the sloped edge (integer value).
margin - setMargin(int)
This value is used to specify the minimum magin (in pixels) around the text which is drawn on the button when the button is in the released state.
semiPush - setSemiPush(int)
This value controls how many pixels down the button should appear to "push" in when the user's mouse floats over it. The default value of 0 disables this "semi push" effect. The value should be less than or equal to the "height" of the button.
foreground - Component.setForeground(java.awt.Color)
The color used for the text when the button is in its released state. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
background - Component.setBackground(java.awt.Color)
The color used for the button when the button is in its released state. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
textPressedColor - setTextPressedColor(java.awt.Color)
The color used for the text when the button is in its pressed state. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
textEchoOn - setTextEchoOn(boolean)
Whether a "text shadow" effect should be used when the mouse pointer floats over a released button (this affect is disabled unless this is specified). See TagLookup.getBoolean(java.lang.String, java.lang.Boolean) for details on specifying colors (or use "true"/"false").
textEchoColor - setTextEchoColor(java.awt.Color)
The color used for a "text shadow" when the mouse pointer floats over a released button (this affect is disabled unless this is specified). See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
textEchoReleasedColor - setTextEchoReleasedColor(java.awt.Color)
The color used for a "text shadow" when the button is released (up). The "textEchoOn" attribute must be set to true and this value must be non-null for it to take affect. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
buttonPressedColor - setButtonPressedColor(java.awt.Color)
The color used for the button when the button is in its pressed state. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
mouseOverColor - setMouseOverColor(java.awt.Color)
The color used for the button when the mouse floats over the button. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
focusMode - setFocusMode(int)
Used to specify what type of "focus mode" is to be used to indicate the button has the keyboard focus. It must be one of the string choices returned by getFocusModeChoices() and is used to set the focus mode.
focusColor - setFocusColor(java.awt.Color)
The color used for the drawing the keyboard focus indicator. See TagLookup.getColor(java.lang.String, java.awt.Color) for details on specifying colors.
inset
Allows you to specify a single integer value to be used as a pixel gap (inset) of the button from its components area (see setInsets(java.awt.Insets)).
align
Allows you to specify how lines of text should be aligned. Valid values: "c" - centered, "l" - left, "r" - right. This parameter has no affect if you have a single line of text.
pos
Allows you to specify how the area which contains the text is aligned. By default, this will be "cp.5,cp.5" which results in text centered on the button. Refer to Align.parse(java.lang.String) for details on the numerous ways to adjust the alignment.

Parameters:
tl - A TagLookup to fetch values from.
Throws:
ParseException
Since:
1.0

setFocusMode

public void setFocusMode(int val)
Set how the button should be "emphasized" when it has focus.

Use one of the following constants to define how the button should appear when it has the focus:

NONE
Don't do anything special when button has focus.
OUTSIDE
Draw a rectangle in the focus color around the outside of the button.
INSIDE
Draw a rectangle in the focus color around the flat top of the button.
AROUND_TEXT
Draw a rectangle around the text drawn on the button.
UNDERLINE_TEXT
Underline the text on the button which has the focus.

Parameters:
val - New int value to assign (if you specify a unrecognized value - it will be ignored).
See Also:
getFocusMode()

getFocusMode

public int getFocusMode()
Get how the button should be "emphasized" when it has focus.

Returns:
Current int value assigned.
See Also:
setFocusMode(int)

getFocusModeChoices

public static String[] getFocusModeChoices()
Get the default list of Strings used to specify focus modes. Since it is undesirable to specify choices in configuration files by numeric values, this method provides a array of "mode" names which can be used to specify the focus mode for the object. This set of choices is used by the set(com.ccg.util.TagLookup) method, but could be used by others as well. The string names and their corresponding focus modes are:
 "None" - NONE
 "Outside" - OUTSIDE
 "Inside" - INSIDE
 "TextBox" - AROUND_TEXT
 "Underline" - UNDERLINE_TEXT
 

Here's a quick example of how one might use this method:


 public static void changeFocusMode(TallButton[] buttons, String val) {
   int mode = TagLookup.choiceValue(val,TallButton.getFocusModeChoices());
                                // if "mode" specified, go set
   if (mode >= 0) for (int i = 0; i < buttons.length; i++) {
     buttons[i].setFocusMode(mode);
   }
 }
 

Returns:
Array of valid String values for specifying a focus mode.
See Also:
Convert.choiceValue(java.lang.String, java.lang.String[]), TagLookup.getChoice(java.lang.String, java.lang.String[])

setFocusColor

public void setFocusColor(Color val)
Set the color to use to show button has focus.

Parameters:
val - New Color value to assign (if you pass null - it will be ignored).
See Also:
getFocusColor()

getFocusColor

public Color getFocusColor()
Get the color to use to show button has focus.

Returns:
Current Color value assigned.
See Also:
setFocusColor(java.awt.Color)

setText

public void setText(String text)
Set the text label which appears on the button. Use this method to control the label which appears on the button. You can disable the label by passing a zero length string (or null). If you disable the button, the size of the top flat area of the button is controlled by the margin border specified.

Parameters:
text - Sets the text label which appears on the button (you may pass null or a zero length string to disable the display of text).
Since:
1.0
See Also:
getText()

getText

public String getText()
Get the text label which appears on the button.

Returns:
The text label which appears on the button (this will never be null - though it may a zero length string).
Since:
1.0
See Also:
setText(java.lang.String)

setButtonHeight

public void setButtonHeight(int h)
Set the height of the button. This parameter controls how many lines of beveled edge are drawn around the button. Larger values result in taller button. Changing this value may also affect the setSemiPush(int) value as well (since its maximum value is limited to the height of the button).

Parameters:
h - Sets the height of the button (if the value is less than 0, it is ignored).
Since:
1.0
See Also:
getButtonHeight()

getButtonHeight

public int getButtonHeight()
Get the height of the button.

Returns:
The height of the button (number of beveled lines drawn around the circomference of the button).
Since:
1.0
See Also:
setButtonHeight(int)

setSemiPush

public void setSemiPush(int v)
Set the semi depressed value of the button. This parameter controls how many lines the button appears to press in when the mouse enters the components area. For example, if this value is set to two, the button will appear to go down two rows of pixels when the user's mouse enters the area.

Parameters:
h - Sets the semi of the button (if the value is less than 0, or greater than the height it is ignored.
Since:
1.0
See Also:
getSemiPush()

getSemiPush

public int getSemiPush()
Get the semi depress value of the button.

Returns:
The semi depress value of the button (number of beveled lines drawn around the circomference of the button).
Since:
1.0
See Also:
setSemiPush(int)

setMargin

public void setMargin(int margin)
Set the amount of margin space around text on top of the button. This parameter controls how much margin space (in pixels) is required (as a desired minimum) around the text which appears on the top of the button. This is used when computing the preferred size of the component.

Parameters:
margin - Sets the amount of space desired around the text (values less than zero are ignored).
Since:
1.0
See Also:
getMargin()

getMargin

public int getMargin()
Get the amount of desired margin space around the text the button.

Returns:
Number of pixels of margin desired around the text on the top of the button.
Since:
1.0
See Also:
setMargin(int)

setTextPressedColor

public void setTextPressedColor(Color c)
Set the color of the text when the button is pressed. Use this method if you want to set the color of the text when the button is its pressed state (color of the text when button is down).

Parameters:
color - New color to set (if you pass null it will be ignored).
Since:
1.0
See Also:
getTextPressedColor()

getTextPressedColor

public Color getTextPressedColor()
Get the color of the text when the button is pressed.

Returns:
Color the text will be drawn in when the button is pressed.
Since:
1.0
See Also:
setTextPressedColor(java.awt.Color)

setTextEchoColor

public void setTextEchoColor(Color c)
Set the "echo" color when button has the focus.

Parameters:
c - The Color to use for emphasizing the text of the button which has the focus. Pass null if you want to disable this feature.
Since:
1.0
See Also:
getTextEchoColor(), setTextEchoOn(boolean)

getTextEchoColor

public Color getTextEchoColor()
Get the color used when echoing text to show user what button they are on.

Returns:
Color used if echoing is enabled to highlight the text on the button with the current focus.
Since:
1.0
See Also:
setTextEchoColor(java.awt.Color)

setTextEchoReleasedColor

public void setTextEchoReleasedColor(Color c)
Set the "echo" color when button is released.

Parameters:
c - The Color to use for emphasizing the text of the button which is released (in a up state), but which doesn't have the mouse over it. Pass null if you want to disable this feature.
Since:
1.0
See Also:
getTextEchoReleasedColor(), setTextEchoOn(boolean)

getTextEchoReleasedColor

public Color getTextEchoReleasedColor()
Get the color used when echoing text on a button in a released state.

Returns:
Color used if echoing is enabled to highlight the text on the button which is released (up), but doesn't have the mouse pointer floating on top.
Since:
1.0
See Also:
setTextEchoReleasedColor(java.awt.Color)

setTextEchoOn

public void setTextEchoOn(boolean val)
Set text echoed (hightlighted) when button has focus. If you enable this option, then when the user moves the mouse pointer over this button, the text drawn on the button will be echoed (drawn twice). This will differentiate the button with the focus from the other buttons which may be displayed.

Parameters:
val - New boolean value to assign - set to true to enable echoing feature, false to disable. see #getTextEchoOn

isTextEchoOn

public boolean isTextEchoOn()
Is text echoed (hightlighted) when button has focus?

Returns:
Current boolean value assigned. see #setTextEchoOn

setButtonPressedColor

public void setButtonPressedColor(Color val)
Set button color when the button is pressed

Parameters:
val - New Color value to assign (if you pass null your value will be ignored).
See Also:
getButtonPressedColor()

getButtonPressedColor

public Color getButtonPressedColor()
Get button color when the button is pressed

Returns:
Current Color value assigned.
See Also:
setButtonPressedColor(java.awt.Color)

setInsets

public void setInsets(Insets val)
Set how much the component should be inset from edges This property controls how much clear area should exist at the edges of the component. The default insets are set to zero causing the button to be drawn to the extent of the components area.

Parameters:
val - New Insets value to assign.
See Also:
getInsets()

getInsets

public Insets getInsets()
Get how much the component should be inset from edges.

Returns:
Current Insets value assigned.
See Also:
setInsets(java.awt.Insets)

update

public void update(Graphics g)
Disable clearing of component area. Since our paint(java.awt.Graphics) method completely draws the component, we can override the default implementation of the update method so that it won't blank our components area (since we will fill it anyway).

Overrides:
update in class Component
Parameters:
g - Graphics context to draw button image onto.
Since:
1.0
See Also:
paint(java.awt.Graphics)

paint

public void paint(Graphics g)
Paints the component on a graphics context. This method takes care of drawing the button in its proper state. The following items are taken into consideration (the settings of the object determine color and whether or not they are done):

Overrides:
paint in class Component
Parameters:
g - Graphics context to draw button image onto.
Since:
1.0
See Also:
paintText(java.awt.Graphics)

paintText

public void paintText(Graphics g)
Paints the text component on a graphics context. This method takes care of drawing the text in it's proper state. The following items are taken into consideration (the settings of the object determine color and whether or not they are done):

Parameters:
g - Graphics context to draw button text onto.
Since:
1.0
See Also:
paint(java.awt.Graphics)

paintInsets

public void paintInsets(Graphics g)
Paints the "inset" border on a graphics context. This method takes care of drawing the flat border around the edges of the component (if the insets is not set to a zero size).

Parameters:
g - Graphics context to insets onto.
Since:
1.0
See Also:
paint(java.awt.Graphics)

getPreferredSize

public Dimension getPreferredSize()
Computes the preferred size of the button. Often layout managers will ask a component what size it would like to be. This method returns the minimum size of the component such that the height, margin, and text requirements will be fullfilled to properly draw the button.

Overrides:
getPreferredSize in class Component
Returns:
The minimum size required to properly draw the button.
Since:
1.0

processEvent

public void processEvent(AWTEvent e)
Monitor for certain MOUSE/KEYBOARD events. Since this is a lightweight component, we need to monitor events and take actions based upon those events. In particular:

isFocusTraversable

public boolean isFocusTraversable()
Indicate that component can be traversed using keyboard.

Overrides:
isFocusTraversable in class Component
Returns:
true - indicating that this component can be traversed using keyboard (typically with tab keys)
Since:
1.0

addActionListener

public void addActionListener(ActionListener l)
Register to receive button press notification.

Parameters:
l - A ActionListener who wants to be notified when the user presses the button (notification is actually during the release).
Since:
1.0
See Also:
removeActionListener(java.awt.event.ActionListener)

removeActionListener

public void removeActionListener(ActionListener l)
Deregister to receive button press notification.

Parameters:
l - A ActionListener who no longer wants to be notified when the user presses the button (notification is actually during the release).
Since:
1.0
See Also:
addActionListener(java.awt.event.ActionListener)

isPressed

public boolean isPressed()
Is the button currently "pressed" (being held down).

Returns:
true if the button is "pressed"
Since:
1.0
See Also:
isEmphasized()

isEmphasized

public boolean isEmphasized()
Should the button be emphasized (is the mouse over it)?

Returns:
true if the mouse pointer is over the button.
Since:
1.0
See Also:
isPressed()

setAlign

public void setAlign(Align val)
Set the Align object used to align the bounding box of the text

Parameters:
val - New Align value to assign.
See Also:
getAlign()

getAlign

public Align getAlign()
Get the Align object used to align the bounding box of the text

Returns:
Current Align value assigned.
See Also:
setAlign(com.ccg.awt.Align)

setMultiLineText

public void setMultiLineText(MultiLineText val)
Set the MultiLineText object which has the text

Parameters:
val - New MultiLineText value to assign.
See Also:
getMultiLineText()

getMultiLineText

public MultiLineText getMultiLineText()
Get the MultiLineText object which has the text

Returns:
Current MultiLineText value assigned.
See Also:
setMultiLineText(com.ccg.awt.MultiLineText)

setMouseOverColor

public void setMouseOverColor(Color val)
Set the color of the button when the mouse pointer is over it You can set this value to 'null' to force the mouse over color to match the "released" state of the button.

Parameters:
val - New Color value to assign.
See Also:
getMouseOverColor()

getMouseOverColor

public Color getMouseOverColor()
Get the color of the button when the mouse pointer is over it

Returns:
Current Color value assigned.
See Also:
setMouseOverColor(java.awt.Color)

getDisabledButtonColor

public Color getDisabledButtonColor()
Get the color to use for buttons when the button is disabled.

Returns:
The color to use for buttons in a disabled state.
Since:
1.0
See Also:
getDisabledTextColor()

getDisabledTextColor

public Color getDisabledTextColor()
Get the color to use for text labels when the button is disabled.

Returns:
The color to use for disabled text labels.
Since:
1.0
See Also:
getDisabledButtonColor()

setEnabled

public void setEnabled(boolean state)
Set whether the button should be enabled or disabled.

This method is used to enable/disable the button. A disabled button will be drawn differently and will not work (won't do anything) when the user presses it.

Overrides:
setEnabled in class Component
Parameters:
enable - Pass true to enable the button to function, pass false to put the button in its "disabled" state.
Since:
1.0


Copyright 1998-1998-2006 null. All Rights Reserved.