com.equitysoft.components
Class IEButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--com.equitysoft.components.IEButton

public class IEButton
extends java.awt.Component
implements java.io.Serializable, EnterExitListener

IEButton is a 'hot' button of the type found in Internet browsers such as Netscape Navigator Version 4. When the cursor passes over the button it's border appears and the image 'lights-up'. The button can have a text label or a tooltip but not both. If no image is specified then the button is a text-only button. If 'setOpaque(true)' is not invoked then the button is 'transparent' and a background image will show through.

A button can be made 'sticky' which means the button will stayed depressed when pushed, until it is pushed again. A sticky button can also be added to IEButton's 'group' which means only one button in the group can be depressed at one time. Whether a button is sticky or not it informs any registered actionListener if it is pushed. By using setRepeat a button will continuously generate actionEvent's while the button is held down.

Any border thickness can be drawn and various label/image positions are supported. IEButton can be extended to change the way the border is drawn or how the image is grayed-out.

Version:
Feb 24, 2000 Compiled with Sun JDK 1.2
Author:
Colin Mummery e-mail:equitysoft@iname.com
See Also:
Serialized Form

Field Summary
static int LABEL_EAST
          The text position constant that places text as a label to the right of the button's image.
static int LABEL_NORTH
          The text position constant that places text as a label above the button's image or in the case of the tooltip position, above the button.
static int LABEL_SOUTH
          The text position constant that places text as a label underneath the button's image or in the case of the tooltip position, below the button.
static int LABEL_WEST
          The text position constant that places text as a label to the left of the button's image.
static int TOOLTIP
          The text position constant that designates that the button's text be used as a tooltip.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
IEButton()
          Constructs an instance of IEButton with no image , no text, with positioning of LABEL_SOUTH and a preferred size of 36 by 36.
IEButton(java.awt.Image image)
          Constructs an instance of IEButton with the specified image but without any associated text.
IEButton(java.awt.Image image, java.lang.String text)
          Constructs an instance of IEButton with the given image and text and an implied text position of LABEL_SOUTH.
IEButton(java.awt.Image image, java.lang.String text, int position)
          Constructs an instance of IEButton with the specified image and textual label or tooltip.
IEButton(java.lang.String text)
          Constructs an instance which is text only.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener target)
          Causes the specified ActionListener's actionPerformed method to be invoked each time the button is clicked.
 void addEnterExitListener(java.lang.Object target)
          Causes the specified EnterExitListener's buttonStateChanged method to be invoked each time the cursor enters or exits the button.
 void buttonStateChanged(EnterExitEvent eee)
          Invoked by another instance of IEButton with which the current instance is registered as a EnterExitEvent listener.
 void fireAction()
          Invoking this method is equivalent to clicking the mouse over the button.
 void fireEnterExit(boolean state)
          This method is not normally invoked directly.
 java.lang.String getActionCommand()
          Returns the value for the actionCommand String.
 java.awt.Image getAlternateImage(java.awt.Image original)
          This method fetches the 'grayed-out' image for the button.
 int getBorderInset()
          Returns the current border inset.
 int getBorderWidth()
          Returns the current border width being used to draw the button.
 java.awt.Color getButtonBackground()
          Returns the background color of the button.
static IEButton getDepressedButton()
          This method returns the currently depressed button instance if any.
 java.awt.Font getFont(java.awt.Font ft)
          Returns the current font used to display the text associated with the button.
 java.lang.String getImageFile()
          This method is invoked by JavaBean tools.
 java.awt.Dimension getMinimumSize()
          Returns the same value as getPreferredSize()
 java.awt.Dimension getPreferredSize()
          Returns The current preferred size dimension.
 long getRepeatInterval()
          Gets the current value of the repeat interval.
 java.lang.String getText()
          Returns the buttons text string.
 java.awt.Color getTextColor()
          Returns the color with which the text is drawn.
 int getTextPosition()
          Returns a value indicating how the text associated with the button is currently being displayed.
 java.awt.Color getTooltipBackground()
          Returns the color used for the tooltip background.
 int getTooltipPosition()
          Returns the current position of the tooltip if tooltips are being used for the button
 long getTooltipTimeDelay()
          Returns The current delay before a tooltip is shown as a long value.
 void invalidate()
          Overidden so that calls to Component.setBounds cause IEButton to recalculate positions
 boolean isDepressed()
          Returns a boolean indicating if the button is depressed.
 boolean isDownDarkened()
          Indicates if the image is darkened when the button is pushed.
 boolean isEnabled()
          Indicates if the button is enabled or not.
 boolean isFocusTraversable()
          Indicates to the AWT if the focus can be transferred to the button and also taken away.
 boolean isGrayOutInverted()
          Indicates how the image is currently grayed.
 boolean isImageGrayOutEnabled()
          Returns a boolean value indicating if graying out is enabled.
 boolean isInGroup()
          Returns a value to indicate if the button is part of a group or not
 boolean isLitup()
          Returns a boolean to indicate if permanent highlighting is on (a true value).
 boolean isOpaque()
          Indicates if the button is to be drawn with an opaque background.
 boolean isOutlineDrawn()
          Returns a boolean value indicating if an outline is to be drawn around the button.
 boolean isSlidingTooltip()
          Indicates if the tooltip is set to slide.
 boolean isSticky()
          Returns a boolean value indicating if toggling is enabled.
 void paint(java.awt.Graphics G)
          Invoked by update , not usually invoked directly
 void paintBorder(java.awt.Graphics G, int width, int height, boolean up, java.awt.Color background, int width_of_border, boolean draw_outline, java.awt.Color outline_color)
          A method that paints the button border.
 void removeActionListener(java.awt.event.ActionListener target)
          Remove this ActionListener from the buttons list of ActionListeners.
 void removeEnterExitListener(java.lang.Object target)
          Remove this EnterExitListener from the buttons list of EnterExitListeners.
 void setActionCommand(java.lang.String command)
          Sets the actionCommand of the ActionEvent delivered when the button is pushed.
 void setBorderInset(int borderinset)
          Sets the button's border inset in pixels.
 void setBorderWidth(int border_width)
          Sets the width of the raised border around the button's edge
 void setButtonBackground(java.awt.Color background)
          Sets the background color of the button.
 void setDepressed(boolean state)
          Sets a sticky button to be depressed or to be released from a depressed state.
 void setDownDarkened(boolean darkened)
          Decides if the image is to darkened or not when the button is pushed.
 void setEnabled(boolean enabled)
          Invoked to enable or disable the button.
 void setFocusTraversable(boolean state)
          Sets the value which is returned by isFocusTraversable().
 void setFont(java.awt.Font font)
          Sets the font of the text.
 void setGrayOutInverted(boolean inverted)
          Changes the way the image is grayed-out.
 void setImage(java.awt.Image img)
          Changes the image at runtime.
 void setImageFile(java.lang.String imgfile)
          This method invoked by JavaBean manipulation tools to set the image.
 void setImageGrayOutEnabled(boolean grayed_out)
          Enables or disables the graying out of the image on a button.
 void setInGroup(boolean state)
          Designates a sticky button to be part of a single mutually exclusive group of IEButton instances that are all sticky.
 void setLitup(boolean on)
          Turns on or off permanent highlighting.
 void setOpaque(boolean opaque)
          Sets the button background to be opaque in which case the background is filled by a single color.
 void setOutlineDrawn(boolean outline)
          Turns on or off the drawing of an outline around the button.
 void setPreferredSize(java.awt.Dimension dim)
          Sets the preferred size of the button.
 void setRepeat(boolean repeat)
          Causes the ActionEvent to be fired repeatedly if the button is held down.
 void setRepeatInterval(long interval)
          Sets the repeat interval of ActionEvent firings when the button is held down and willRepeat() returns a value of true.
 void setSlidingTooltip(boolean sliding)
          Sets the way in which the tooltip appears if it is used.
 void setSticky(boolean sticky)
          Turns on or off button toggling.
 void setText(java.lang.String text)
          Sets the text used for the button's text label or tooltip depending on the boolean value in the constructor.
 void setTextColor(java.awt.Color col)
          Sets the color with which the text is drawn.
 void setTextPosition(int position)
          Sets the position of the text relative to the image.
 void setTooltipBackground(java.awt.Color col)
          Sets the color used for the background of the tooltip.
 void setTooltipPosition(int position)
          Sets the position of the tooltip.
 void setTooltipTimeDelay(long boxwait)
          Sets the delay (in MilliSeconds) before a tooltip appears after the cursor is moved over the button.
 void update(java.awt.Graphics G)
          Invoked by Component.repaint() - not usually invoked directly
 boolean willRepeat()
          Indicates if the button will repeatedly fire the ActionEvent if the button is held down.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, 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, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isLightweight, 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, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOOLTIP

public static final int TOOLTIP
The text position constant that designates that the button's text be used as a tooltip.

LABEL_SOUTH

public static final int LABEL_SOUTH
The text position constant that places text as a label underneath the button's image or in the case of the tooltip position, below the button.

LABEL_EAST

public static final int LABEL_EAST
The text position constant that places text as a label to the right of the button's image.

LABEL_NORTH

public static final int LABEL_NORTH
The text position constant that places text as a label above the button's image or in the case of the tooltip position, above the button.

LABEL_WEST

public static final int LABEL_WEST
The text position constant that places text as a label to the left of the button's image.
Constructor Detail

IEButton

public IEButton()
Constructs an instance of IEButton with no image , no text, with positioning of LABEL_SOUTH and a preferred size of 36 by 36. Intended for use by JavaBean development tools such as Sun's BDK but can be used directly to create a blank button.

IEButton

public IEButton(java.lang.String text)
Constructs an instance which is text only. This button is pretty much identical to the AWT.Button in appearance when highlighted.
Parameters:
text - A String which is the label of the button.

IEButton

public IEButton(java.awt.Image image)
Constructs an instance of IEButton with the specified image but without any associated text. A text label or tooltip can be later added to the button by invoking setText(). The preferred size of the button will be the image dimension plus the default border inset (the default inset is 8 pixels).
Parameters:
image - The image to be displayed on the button.

IEButton

public IEButton(java.awt.Image image,
                java.lang.String text)
Constructs an instance of IEButton with the given image and text and an implied text position of LABEL_SOUTH.
Parameters:
image - The Image to be displayed in the button above the text.
text - The String to be displayed below the image.

IEButton

public IEButton(java.awt.Image image,
                java.lang.String text,
                int position)
Constructs an instance of IEButton with the specified image and textual label or tooltip. The boolean tooltip specifies if the text is to be used as a tooltip or used as a label in the button.
Parameters:
image - The Image to be displayed in the button. If null no image is displayed and the button is treated as a text-only button.
text - The String for the tooltip or label text of the button. If null then no text will be displayed.
toolip - A boolean value indicating if the button has a tooltip or text label. true if the button has a text tooltip, false if the button has a text label. The tooltip is a box of text that appears if the cursor remains over the button for a preset period of time. The text label is text that appears below the image. It is not possible to have both in the same button.
Method Detail

buttonStateChanged

public void buttonStateChanged(EnterExitEvent eee)
Invoked by another instance of IEButton with which the current instance is registered as a EnterExitEvent listener. This allows two related buttons to 'light-up' simultaneously if the cursor moves over either one (such behaviour is seen in a well known internet browser). Alternatively some other action such as the display of an explanatory text message might be shown if the cursor is over the button.
Specified by:
buttonStateChanged in interface EnterExitListener

getAlternateImage

public java.awt.Image getAlternateImage(java.awt.Image original)
This method fetches the 'grayed-out' image for the button. By overidding this method in an extended class the user can define their own way of filtering the image.
Parameters:
original - The original image which is displayed when the cursor is over the button
Returns:
Image The image which is to be displayed when the cursor is not over the button.
See Also:
setGrayOutInverted(boolean)

setGrayOutInverted

public void setGrayOutInverted(boolean inverted)
Changes the way the image is grayed-out. By default the image is 'grayed-out' by lightening colors. This method activates an alternate method which is to produce a negative of the original image. This look is best used with black and white images although color images can also respond well. Note that when the style of grayout is set for one button then all subsequently created button instances will automatically use this grayout style.
Parameters:
inverted - A boolean value to indicate how the image should be grayed out. A true value indicates that an inversion filter should be used to produce the grayed-out image.
See Also:
isGrayOutInverted()

isGrayOutInverted

public boolean isGrayOutInverted()
Indicates how the image is currently grayed. The default is not to use inversion.
Returns:
boolean A value of true indicates an inversion filter is being used.
See Also:
setGrayOutInverted(boolean)

setDownDarkened

public void setDownDarkened(boolean darkened)
Decides if the image is to darkened or not when the button is pushed.
Parameters:
darkened - A boolean value to indicate if the image is darkened on pushing the button. A true value indicates that the image should be darkened.
See Also:
isDownDarkened()

isDownDarkened

public boolean isDownDarkened()
Indicates if the image is darkened when the button is pushed. The default is not to darken.
Returns:
boolean A value of true indicates that the image is darkened.
See Also:
setDownDarkened(boolean)

addEnterExitListener

public void addEnterExitListener(java.lang.Object target)
Causes the specified EnterExitListener's buttonStateChanged method to be invoked each time the cursor enters or exits the button. The EnterExitListener object is added to a list of EnterExitListeners managed by this button, it can be removed with removeEnterExitListener.
Parameters:
target - The EnterExitListener to be added.
See Also:
removeEnterExitListener(java.lang.Object)

removeEnterExitListener

public void removeEnterExitListener(java.lang.Object target)
Remove this EnterExitListener from the buttons list of EnterExitListeners. If not registered do nothing.
Parameters:
target - The EnterExitListener to be removed.
See Also:
addEnterExitListener(java.lang.Object)

fireEnterExit

public void fireEnterExit(boolean state)
This method is not normally invoked directly. The buttonStateChanged methods of all registered EnterExitListeners are invoked.
Parameters:
state - true indicates the cursor has entered the button. false indicates that the cursor has exited the button.
See Also:
addActionListener(java.awt.event.ActionListener)

setImageFile

public void setImageFile(java.lang.String imgfile)
This method invoked by JavaBean manipulation tools to set the image. it should not be invoked directly by the programmer. Instead set the image with the constructor.

getImageFile

public java.lang.String getImageFile()
This method is invoked by JavaBean tools. It should not be invoked directly by the programmer.
Returns:
An ImageInfo instance that contains JavaBean related data about the image.

setImage

public void setImage(java.awt.Image img)
Changes the image at runtime. The new image should be the same size as the original image otherwise the result is unpredictable
Parameters:
img - The Image which is to be the new button image

setTooltipPosition

public void setTooltipPosition(int position)
Sets the position of the tooltip. The values can be LABEL_NORTH or LABEL_SOUTH. The default is LABEL_SOUTH.
Parameters:
position - An int value to indicate the tooltip position
See Also:
getTooltipPosition()

getTooltipPosition

public int getTooltipPosition()
Returns the current position of the tooltip if tooltips are being used for the button
See Also:
setTooltipPosition(int)

setSlidingTooltip

public void setSlidingTooltip(boolean sliding)
Sets the way in which the tooltip appears if it is used. If set to true the tooltip will slide into view rather than just appearing. This results in a slicker GUI depending on your point of view. The default is for sliding to be turned off (ie. false).
Parameters:
enabled - A boolean value to indicate if the tooltip is to slide
See Also:
isSlidingTooltip()

isSlidingTooltip

public boolean isSlidingTooltip()
Indicates if the tooltip is set to slide.
Returns:
true if the tooltip slides into view.
See Also:
setSlidingTooltip(boolean)

setEnabled

public void setEnabled(boolean enabled)
Invoked to enable or disable the button. If disabled the button's text label will be grayed out as well as the image if present. Moving the cursor over the button has no effect.
Overrides:
setEnabled in class java.awt.Component
Parameters:
enabled - A boolean value to indicate if the button is to be enabled
See Also:
isEnabled()

isEnabled

public boolean isEnabled()
Indicates if the button is enabled or not.
Overrides:
isEnabled in class java.awt.Component
Returns:
true if the button is enabled.
See Also:
setEnabled(boolean)

invalidate

public void invalidate()
Overidden so that calls to Component.setBounds cause IEButton to recalculate positions
Overrides:
invalidate in class java.awt.Component

update

public void update(java.awt.Graphics G)
Invoked by Component.repaint() - not usually invoked directly
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics G)
Invoked by update , not usually invoked directly
Overrides:
paint in class java.awt.Component

paintBorder

public void paintBorder(java.awt.Graphics G,
                        int width,
                        int height,
                        boolean up,
                        java.awt.Color background,
                        int width_of_border,
                        boolean draw_outline,
                        java.awt.Color outline_color)
A method that paints the button border. This method should be overidden in an extended class if the programmer wants to redefine the look of the border. The border inset should be set appropriately if the image and/or text label shouldn't overlap the border.
Parameters:
G - The GraphicsContext used to paint the border.
width - The width of the button in which the border can be painted.
height - The height of the button in which the border can be painted.
up - A boolean value that is true if the button is up.
background - The Color that should be lightened or darkened to achieve an up/down effect.
width_of_border - An int value indicating the pixel width of the border.
draw_outline - A boolean value indicating if the outline should be drawn.
outline_color - A Color instance to be used for drawing the outline.

setTextPosition

public void setTextPosition(int position)
Sets the position of the text relative to the image. The possible value are TOOLTIP, LABEL_SOUTH, LABEL_EAST, LABEL_NORTH, LABEL_WEST .
Parameters:
position - An int value indicating how the text associated with this button is to be used.
See Also:
getTextPosition()

getTextPosition

public int getTextPosition()
Returns a value indicating how the text associated with the button is currently being displayed.
Returns:
An int value which can be one of TOOLTIP, LABEL_SOUTH, LABEL_EAST, LABEL_NORTH, LABEL_WEST.
See Also:
setTextPosition(int), IEButton(Image,String,int)

setOutlineDrawn

public void setOutlineDrawn(boolean outline)
Turns on or off the drawing of an outline around the button. The outline is one pixel wide and is the same color as the text color. The outline gives emphasis to the button. If the border width has a value of one when the outline is switched on, IEButton increases the border width to a value of two to give a better looking button.
Parameters:
outline - A boolean value of true indicates that an outline should be drawn around the button.
See Also:
isOutlineDrawn()

isOutlineDrawn

public boolean isOutlineDrawn()
Returns a boolean value indicating if an outline is to be drawn around the button.
Returns:
true if an outline is to be drawn around the button.
See Also:
setOutlineDrawn(boolean)

setSticky

public void setSticky(boolean sticky)
Turns on or off button toggling. Toggling means that when the IEButton is pushed that button stays in the pushed position and any other IEButton already in the pushed position is released. The button can be said to be 'sticky'.
Parameters:
sticky - A boolean value of true indicates that toggling should be enabled
See Also:
isSticky()

isSticky

public boolean isSticky()
Returns a boolean value indicating if toggling is enabled.
Returns:
true if toggling is enabled.
See Also:
setSticky(boolean)

setInGroup

public void setInGroup(boolean state)
Designates a sticky button to be part of a single mutually exclusive group of IEButton instances that are all sticky. If set to true then only one button of the group of sticky buttons can be depressed at one time. If a button in the group is pushed only the pushed button's ActionEvent is fired. If the button is not sticky then it is automatically made sticky when added to the group. There can only be one unnamed group in an application. Programmers needing more than one group should use Sun's JFC classes.
Parameters:
state - A boolean value oftrue designates the button of part of the group.
See Also:
isInGroup()

isInGroup

public boolean isInGroup()
Returns a value to indicate if the button is part of a group or not
Returns:
boolean A value of true indicates the button is in the group.

setImageGrayOutEnabled

public void setImageGrayOutEnabled(boolean grayed_out)
Enables or disables the graying out of the image on a button. Some programmers may prefer to have an image that is never grayed out even if the cursor is not over the button. The default state is that the image is grayed out when the cursor is not over the button.
Parameters:
grayedout - A boolean value of false indicates the image should not be grayed out when the cursor is not over the button. setEnabled(false) will still gray out the image though.
See Also:
isImageGrayOutEnabled()

isImageGrayOutEnabled

public boolean isImageGrayOutEnabled()
Returns a boolean value indicating if graying out is enabled.
Returns:
true if the graying out of images occurs even if the cursor is not over the button.
See Also:
setImageGrayOutEnabled(boolean)

setLitup

public void setLitup(boolean on)
Turns on or off permanent highlighting. If set to true the button will be always highlighted , if set false (which is the default) the button will only be highlighted if the cursor is over it.
Parameters:
on - A boolean value to indicate if highlighting should be permanently on.
See Also:
isLitup()

isLitup

public boolean isLitup()
Returns a boolean to indicate if permanent highlighting is on (a true value).
Returns:
true indicates that the button will always be highlighted.
See Also:
setLitup(boolean)

setFont

public void setFont(java.awt.Font font)
Sets the font of the text.
Overrides:
setFont in class java.awt.Component
Parameters:
font - The font in which the text is to appear.
See Also:
getFont(java.awt.Font)

getFont

public java.awt.Font getFont(java.awt.Font ft)
Returns the current font used to display the text associated with the button.
Returns:
The font being used to display the button's text.
See Also:
setFont(java.awt.Font)

setBorderInset

public void setBorderInset(int borderinset)
Sets the button's border inset in pixels. This is the blankspace gap between the edge of the button and the image. If the button has a text label then it is also the gap between the image and the text as well as the text and the buttons bottom edge. The default is 4.
Parameters:
borderinset - The new value of the border inset.

getBorderInset

public int getBorderInset()
Returns the current border inset.
Returns:
The number of pixels being used for the current inset.
See Also:
setBorderInset(int)

setBorderWidth

public void setBorderWidth(int border_width)
Sets the width of the raised border around the button's edge
Parameters:
border_width - An int value indicating the border width to be used.
See Also:
getBorderWidth()

getBorderWidth

public int getBorderWidth()
Returns the current border width being used to draw the button.
Returns:
An int value representing the current border width.
See Also:
setBorderWidth(int)

setPreferredSize

public void setPreferredSize(java.awt.Dimension dim)
Sets the preferred size of the button. When the button is added to a Java container the container's layout manager will use this dimension to allocate space in the layout for the button. If the preferred size is never set or set to null then IEButton will calculate a preferred size based on the image size , the border inset and the presence (or absence) of a text label under the image. if the image is null then the button has a default preferred size of 36 by 36.
Parameters:
dim - The font in which the text is to appear.
See Also:
getPreferredSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns The current preferred size dimension.
Overrides:
getPreferredSize in class java.awt.Component
Returns:
A Dimension instance representing the current preferred size.
See Also:
setPreferredSize(java.awt.Dimension)

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the same value as getPreferredSize()
Overrides:
getMinimumSize in class java.awt.Component
Returns:
The minimum dimension of the button. Used by layout managers to allocate space.

setText

public void setText(java.lang.String text)
Sets the text used for the button's text label or tooltip depending on the boolean value in the constructor. If the parameter is null then the text is set to the be an empty String.
Parameters:
String - The text of the label or tooltip.
See Also:
getText()

getText

public java.lang.String getText()
Returns the buttons text string. Never returns null.
Returns:
The text used for the button label or tooltip.
See Also:
setText(java.lang.String)

setTextColor

public void setTextColor(java.awt.Color col)
Sets the color with which the text is drawn. If not set explicitly the default is black.
Parameters:
Color - The color with which the text is drawn.
See Also:
getTextColor()

getTextColor

public java.awt.Color getTextColor()
Returns the color with which the text is drawn.
Returns:
The color with which the text is drawn.
See Also:
setTextColor(java.awt.Color)

setOpaque

public void setOpaque(boolean opaque)
Sets the button background to be opaque in which case the background is filled by a single color. If the color has not been set with a call to setButtonBackgroundColor then the color used will be background color of the button's container. By default IEButton instances are transparent and not opaque.
Parameters:
opaque - A boolean value where true means the background is to be filled.
See Also:
isOpaque(), setButtonBackground(java.awt.Color)

isOpaque

public boolean isOpaque()
Indicates if the button is to be drawn with an opaque background. A value of true indicates that the background is opaque.
Overrides:
isOpaque in class java.awt.Component
Returns:
boolean A value of true indicates that the button is opaque.
See Also:
setOpaque(boolean), setButtonBackground(java.awt.Color)

setButtonBackground

public void setButtonBackground(java.awt.Color background)
Sets the background color of the button. For this background color to be used then the button must be set to be opaque by invoking setOpaque(true)
Parameters:
background - The color with which the backgroound is drawn.
See Also:
getButtonBackground(), setOpaque(boolean)

getButtonBackground

public java.awt.Color getButtonBackground()
Returns the background color of the button. If never set this value is the background color of the button's parent container. .
Returns:
The color which is used to fill the background of an opaque IEButton.
See Also:
setButtonBackground(java.awt.Color)

setTooltipBackground

public void setTooltipBackground(java.awt.Color col)
Sets the color used for the background of the tooltip. If not set explicitly the default is white. If the button doesn't have the tooltip enabled this method will do nothing.
Parameters:
Color - The color which will be used for the tooltip background.
See Also:
getTooltipBackground()

getTooltipBackground

public java.awt.Color getTooltipBackground()
Returns the color used for the tooltip background.
Returns:
The color used for the tooltip background.
See Also:
setTooltipBackground(java.awt.Color)

setDepressed

public void setDepressed(boolean state)
Sets a sticky button to be depressed or to be released from a depressed state. If another sticky button is currently depressed then that button is released. Setting a button to be depressed or released does not fire an ActionEvent. Only used if the method isSticky() returns a value of true.
Parameters:
state - A boolean value of true sets the button to be depressed.
See Also:
isDepressed()

isDepressed

public boolean isDepressed()
Returns a boolean indicating if the button is depressed. Only used for 'sticky' buttons
Returns:
A boolean value of true indicates the button is currently depressed.
See Also:
setDepressed(boolean)

getDepressedButton

public static IEButton getDepressedButton()
This method returns the currently depressed button instance if any. Any button returned must necessarily be both depressed and designated to be sticky by first invoking the method setSticky(true).
Returns:
The IEButton which is currently depressed. Returns null is no button is in the depressed state.

setTooltipTimeDelay

public void setTooltipTimeDelay(long boxwait)
Sets the delay (in MilliSeconds) before a tooltip appears after the cursor is moved over the button. The default is 800. The tooltip appears directly below the button and dissapears when the button is pushed or when the cursor is no longer over the button.
Parameters:
long - The delay is MilliSeconds before the tooltip appears.
See Also:
getTooltipTimeDelay()

getTooltipTimeDelay

public long getTooltipTimeDelay()
Returns The current delay before a tooltip is shown as a long value.
Returns:
A long value which is the current tooltip delay.
See Also:
setTooltipTimeDelay(long)

setActionCommand

public void setActionCommand(java.lang.String command)
Sets the actionCommand of the ActionEvent delivered when the button is pushed. If never set then the value is the text associated with the button. This mimics the behaviour of the java.awt.Button component. The mouse button must be released over the button for an event to be sent to registered listeners.
Parameters:
command - A String which is to be delivered with the ActionEvent.
See Also:
getActionCommand()

getActionCommand

public java.lang.String getActionCommand()
Returns the value for the actionCommand String. If never explicitly set the this method returns the value of the text associated with the button.
Returns:
The String representing the actionCommand fired by this button.
See Also:
setActionCommand(java.lang.String)

addActionListener

public void addActionListener(java.awt.event.ActionListener target)
Causes the specified ActionListener's actionPerformed method to be invoked each time the button is clicked. The ActionListener object is added to a list of ActionListeners managed by this button, it can be removed with removeActionListener. Note: ActionListeners will not be notified in any particular order.
Parameters:
target - The ActionListener to be added.
See Also:
removeActionListener(java.awt.event.ActionListener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener target)
Remove this ActionListener from the buttons list of ActionListeners. If not registered do nothing.
Parameters:
target - The ActionListener to be removed.
See Also:
addActionListener(java.awt.event.ActionListener)

isFocusTraversable

public boolean isFocusTraversable()
Indicates to the AWT if the focus can be transferred to the button and also taken away. The default return value is false. The method setFocusTraversable should be invoked to set the value to true.
Overrides:
isFocusTraversable in class java.awt.Component
See Also:
setFocusTraversable(boolean)

setFocusTraversable

public void setFocusTraversable(boolean state)
Sets the value which is returned by isFocusTraversable(). The default is false. If set to true then the focus can be transferred by the appropriate key sequence (the 'tab' key on Win95). Consecutive transfers moves the focus from component to component and when IEButton gets the focus the button becomes highlighted. When highlighted in this way a subsequent pressing of the 'enter' key will cause the buttons ActionEvent to be fired.
Parameters:
state - A boolean value to indicate if the focus is to be traversable or not across this button.
See Also:
isFocusTraversable()

setRepeat

public void setRepeat(boolean repeat)
Causes the ActionEvent to be fired repeatedly if the button is held down. If this method is not invoked then the default state is that repeat firing won't be enabled.
Parameters:
repeat - A boolean value of true indicates that repeat firing occurs if the button is held down.
See Also:
willRepeat()

willRepeat

public boolean willRepeat()
Indicates if the button will repeatedly fire the ActionEvent if the button is held down.
Returns:
A boolean value of true indicates the button will repeatedly fire the ActionEvent.
See Also:
setRepeat(boolean)

setRepeatInterval

public void setRepeatInterval(long interval)
Sets the repeat interval of ActionEvent firings when the button is held down and willRepeat() returns a value of true.
Parameters:
interval - A long value which is the repeat interval in milliseconds. The default value is 60 milliseconds.
See Also:
getRepeatInterval()

getRepeatInterval

public long getRepeatInterval()
Gets the current value of the repeat interval.
Returns:
The repeat interval in milliseconds.
See Also:
setRepeatInterval(long)

fireAction

public void fireAction()
Invoking this method is equivalent to clicking the mouse over the button. This is not normally invoked directly. The actionPeformed methods of all registered ActionListeners are invoked.
See Also:
addActionListener(java.awt.event.ActionListener)