-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCheckBoxIcon.java
More file actions
58 lines (54 loc) · 1.96 KB
/
CheckBoxIcon.java
File metadata and controls
58 lines (54 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @(#)CheckBoxIcon.java 1.0 03/18/09
*/
package darrylbu.renderer;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.UIManager;
public class CheckBoxIcon extends ToggleButtonIcon {
/**
* Creates a <CODE>CheckBoxIcon</CODE> for a JCheckBox with the
* horizontal and vertical positioning derived from the horizontal and
* vertical positions of the check box's text relative to its icon.
*
* @param checkBox the check box
* @param customIcon the icon
*/
public CheckBoxIcon(JCheckBox checkBox, Icon customIcon) {
this(checkBox, customIcon,
ToggleButtonIcon.getHorizontalPosition(checkBox),
checkBox.getVerticalTextPosition());
}
/**
* Creates a <CODE>CheckBoxIcon</CODE> for a JCheckBox with the
* specified horizontal and vertical positioning.
*
* @param checkBox the check box
* @param customIcon the icon
* @param horizontalPosition the horizontal position of the custom icon
* relative to the default icon. One of the following values:
* <ul>
* <li>{@code SwingConstants.RIGHT}
* <li>{@code SwingConstants.LEFT}
* <li>{@code SwingConstants.CENTER}
* <li>{@code SwingConstants.LEADING}
* <li>{@code SwingConstants.TRAILING}
* </ul>
* LEADING and TRAILING will be interpreted in the context of the
* check box's ComponentOrientation.
* <P>
* @param verticalPosition the vertical position of the custom icon
* relative to the default icon
* One of the following values:
* <ul>
* <li>{@code SwingConstants.CENTER}
* <li>{@code SwingConstants.TOP}
* <li>{@code SwingConstants.BOTTOM}
* </ul>
*/
public CheckBoxIcon(JCheckBox checkBox, Icon customIcon,
int horizontalPosition, int verticalPosition) {
super(checkBox, customIcon, UIManager.getIcon("CheckBox.icon"),
horizontalPosition, verticalPosition);
}
}