com.vlsolutions.swing.tabbedpane
Class SmartIconJButton
java.lang.Object
com.vlsolutions.swing.tabbedpane.SmartIconJButton
- Icon, PropertyChangeListener
public class SmartIconJButton
extends java.lang.Object
implements Icon, PropertyChangeListener
A sub component of JTabbedPaneSmartIcon, used to describe a button included in a tabbedpane.
As JTabbedPanes cannot use any JComponents as tab selectors (the access if protected and we just have
a label, an icon and a tooltip), we have to rely on tricks to bypass them.
This trick, the SmartIconJButton is an icon faking the behaviour of a button. It uses an Action
for reacting to clicks and manages a set of images (default, rollover, pressed, disabled) to
behave like a rollover button.
protected Action | action - The action triggered when the clicks on the icon
|
protected Icon | defaultIcon - the default icon (enabled/visible)
|
protected Icon | disabledIcon - the icon for the disabled effect
|
protected Icon | pressedIcon - the icno for the pressed effect
|
protected Icon | rolloverIcon - the icon for the rollover effect
|
protected String | tooltipText - the tooltip associated with the button
|
action
protected Action action
The action triggered when the clicks on the icon
defaultIcon
protected Icon defaultIcon
the default icon (enabled/visible)
disabledIcon
protected Icon disabledIcon
the icon for the disabled effect
pressedIcon
protected Icon pressedIcon
the icno for the pressed effect
rolloverIcon
protected Icon rolloverIcon
the icon for the rollover effect
tooltipText
protected String tooltipText
the tooltip associated with the button
SmartIconJButton
public SmartIconJButton(Action action)
Constructs a new button with an action.
The button is enabled and visible.
fireAction
public void fireAction(ActionEvent e)
triggers the associated action
getDisabledIcon
public Icon getDisabledIcon()
Returns the disabled icon
getIcon
public Icon getIcon()
Returns the default icon
getIconHeight
public int getIconHeight()
getIconWidth
public int getIconWidth()
getPressedIcon
public Icon getPressedIcon()
Returns the pressed icon
getRolloverIcon
public Icon getRolloverIcon()
Returns the rollover icon
getTooltipText
public String getTooltipText()
isEnabled
public boolean isEnabled()
Returns the enabled state
isPressed
public boolean isPressed()
Returns the pressed state
isRollover
public boolean isRollover()
Returns the rollover state
isVisible
public boolean isVisible()
Returns the visible state
paintIcon
public void paintIcon(java.awt.Component c,
Graphics g,
int x,
int y)
paints the appropriate icon according to its internal state (pressed, rollover...)
propertyChange
public void propertyChange(PropertyChangeEvent evt)
Do not call directly as it a side effect of listening to the action changes.
setDisabledIcon
public void setDisabledIcon(Icon icon)
Update the disabled icon property
setEnabled
public void setEnabled(boolean isEnabled)
Update the enabled state
setIcon
public void setIcon(Icon icon)
Update the default icon property
setPressed
public void setPressed(boolean isPressed)
Update the pressed state
setPressedIcon
public void setPressedIcon(Icon icon)
Update the pressed icon property
setRollover
public void setRollover(boolean isRollover)
Update the rollover state
setRolloverIcon
public void setRolloverIcon(Icon icon)
Update the rollover icon property
setTooltipText
public void setTooltipText(String tooltip)
setVisible
public void setVisible(boolean isVisible)
Update the visible state
© Copyright 2004-2006 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications