|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vlsolutions.swing.tabbedpane.SmartIconJButton
public class SmartIconJButton
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.
Field Summary | |
---|---|
protected javax.swing.Action |
action
The action triggered when the clicks on the icon |
protected javax.swing.Icon |
defaultIcon
the default icon (enabled/visible) |
protected javax.swing.Icon |
disabledIcon
the icon for the disabled effect |
protected javax.swing.Icon |
pressedIcon
the icno for the pressed effect |
protected javax.swing.Icon |
rolloverIcon
the icon for the rollover effect |
protected java.lang.String |
tooltipText
the tooltip associated with the button |
Constructor Summary | |
---|---|
SmartIconJButton(javax.swing.Action action)
Constructs a new button with an action. |
Method Summary | |
---|---|
void |
fireAction(java.awt.event.ActionEvent e)
triggers the associated action |
javax.swing.Icon |
getDisabledIcon()
Returns the disabled icon |
javax.swing.Icon |
getIcon()
Returns the default icon |
int |
getIconHeight()
|
int |
getIconWidth()
|
javax.swing.Icon |
getPressedIcon()
Returns the pressed icon |
javax.swing.Icon |
getRolloverIcon()
Returns the rollover icon |
java.lang.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(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paints the appropriate icon according to its internal state (pressed, rollover...) |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Do not call directly as it a side effect of listening to the action changes. |
void |
setDisabledIcon(javax.swing.Icon icon)
Update the disabled icon property |
void |
setEnabled(boolean isEnabled)
Update the enabled state |
void |
setIcon(javax.swing.Icon icon)
Update the default icon property |
void |
setPressed(boolean isPressed)
Update the pressed state |
void |
setPressedIcon(javax.swing.Icon icon)
Update the pressed icon property |
void |
setRollover(boolean isRollover)
Update the rollover state |
void |
setRolloverIcon(javax.swing.Icon icon)
Update the rollover icon property |
void |
setTooltipText(java.lang.String tooltip)
|
void |
setVisible(boolean isVisible)
Update the visible state |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.swing.Action action
protected javax.swing.Icon defaultIcon
protected javax.swing.Icon rolloverIcon
protected javax.swing.Icon pressedIcon
protected javax.swing.Icon disabledIcon
protected java.lang.String tooltipText
Constructor Detail |
---|
public SmartIconJButton(javax.swing.Action action)
Method Detail |
---|
public void setIcon(javax.swing.Icon icon)
public javax.swing.Icon getIcon()
public void setRolloverIcon(javax.swing.Icon icon)
public javax.swing.Icon getRolloverIcon()
public void setPressedIcon(javax.swing.Icon icon)
public javax.swing.Icon getPressedIcon()
public void setDisabledIcon(javax.swing.Icon icon)
public javax.swing.Icon getDisabledIcon()
public void setRollover(boolean isRollover)
public void setEnabled(boolean isEnabled)
public void setVisible(boolean isVisible)
public void setPressed(boolean isPressed)
public boolean isRollover()
public boolean isPressed()
public boolean isEnabled()
public boolean isVisible()
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public void fireAction(java.awt.event.ActionEvent e)
public java.lang.String getTooltipText()
public void setTooltipText(java.lang.String tooltip)
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |