Groovy Documentation

com.wordpress.tipsforjava.swing
[Java] Class ToggleButtonIcon

java.lang.Object
  com.wordpress.tipsforjava.swing.DualIcon
      com.wordpress.tipsforjava.swing.ToggleButtonIcon

public abstract class ToggleButtonIcon
extends DualIcon

The base class for displying an additional custom icon on a JCheckBox or JRadioButton. Subclasses should furnish the default Icon provided by the Look and Feel using UIManager.getIcon(...).

The gap between the icons is always equal to the gap between the button's icon and text.

Extends DualIcon.

Authors:
Rob Camick
Darryl Burke
Version:
1.0 03/11/09


Field Summary
 
Fields inherited from class DualIcon
height, icon1, icon1HOffset, icon1VOffset, icon2, icon2HOffset, icon2VOffset, iconIconGap, width
 
Constructor Summary
protected ToggleButtonIcon(JToggleButton button, Icon customIcon, Icon defaultIcon, int horizontalPosition, int verticalPosition)

Creates a ToggleButtonIcon with the specified horizontal and vertical positioning.

 
Method Summary
protected static int getHorizontalPosition(JToggleButton button)

private static int getHorizontalPosition(JToggleButton button, int horizontalPosition)

 
Methods inherited from class DualIcon
checkHorizontalKey, checkVerticalKey, getIconHeight, getIconWidth, paintIcon
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

ToggleButtonIcon

protected ToggleButtonIcon(JToggleButton button, Icon customIcon, Icon defaultIcon, int horizontalPosition, int verticalPosition)
Creates a ToggleButtonIcon with the specified horizontal and vertical positioning.
Parameters:
button - the button
customIcon - the icon
defaultIcon - the default icon for the button
horizontalPosition - the horizontal position of the custom icon relative to the default icon. One of the following values:
  • SwingConstants.RIGHT
  • SwingConstants.LEFT
  • SwingConstants.CENTER
  • SwingConstants.LEADING
  • SwingConstants.TRAILING
LEADING and TRAILING will be interpreted in the context of the button's ComponentOrientation.

verticalPosition - the vertical position of the custom icon relative to the default icon One of the following values:
  • SwingConstants.CENTER
  • SwingConstants.TOP
  • SwingConstants.BOTTOM


 
Method Detail

getHorizontalPosition

protected static int getHorizontalPosition(JToggleButton button)


getHorizontalPosition

private static int getHorizontalPosition(JToggleButton button, int horizontalPosition)


 

Groovy Documentation