com.vlsolutions.swing.tabbedpane
public class SmartIconJButton extends Object implements Icon, PropertyChangeListener
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.
Field Summary | |
---|---|
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 |
Constructor Summary | |
---|---|
SmartIconJButton(Action action) Constructs a new button with an action.
|
Method Summary | |
---|---|
void | fireAction(ActionEvent e) triggers the associated action |
Icon | getDisabledIcon() Returns the disabled icon |
Icon | getIcon() Returns the default icon |
int | getIconHeight() |
int | getIconWidth() |
Icon | getPressedIcon() Returns the pressed icon |
Icon | getRolloverIcon() Returns the rollover icon |
String | getTooltipText() |
boolean | isEnabled() Returns the enabled state |
boolean | isPressed() Returns the pressed state |
boolean | isRollover() Returns the rollover state |
boolean | isVisible() Returns the visible state |
void | paintIcon(Component c, Graphics g, int x, int y) paints the appropriate icon according to its internal state (pressed, rollover...) |
void | propertyChange(PropertyChangeEvent evt) Do not call directly as it a side effect of listening to the action changes. |
void | setDisabledIcon(Icon icon) Update the disabled icon property |
void | setEnabled(boolean isEnabled) Update the enabled state |
void | setIcon(Icon icon) Update the default icon property |
void | setPressed(boolean isPressed) Update the pressed state |
void | setPressedIcon(Icon icon) Update the pressed icon property |
void | setRollover(boolean isRollover) Update the rollover state |
void | setRolloverIcon(Icon icon) Update the rollover icon property |
void | setTooltipText(String tooltip) |
void | setVisible(boolean isVisible) Update the visible state |