1 |
package skrueger.swing; |
2 |
|
3 |
import java.awt.Font; |
4 |
|
5 |
import javax.swing.Action; |
6 |
import javax.swing.Icon; |
7 |
import javax.swing.JButton; |
8 |
import javax.swing.JLabel; |
9 |
|
10 |
public class ThinButton extends JButton { |
11 |
|
12 |
public static final float BUTTON_FONT_SIZE = 11; |
13 |
public static final int BUTTON_FONT_STYLE = Font.PLAIN; |
14 |
static final Font thinFont = new JLabel().getFont().deriveFont( |
15 |
BUTTON_FONT_STYLE, BUTTON_FONT_SIZE); |
16 |
|
17 |
public ThinButton(String label) { |
18 |
this(label, null); |
19 |
} |
20 |
|
21 |
public ThinButton(Action action) { |
22 |
super(action); |
23 |
|
24 |
init(); |
25 |
} |
26 |
|
27 |
private void init() { |
28 |
setFont(thinFont); |
29 |
} |
30 |
|
31 |
public ThinButton(String label, Icon icon) { |
32 |
super(label, icon); |
33 |
|
34 |
init(); |
35 |
} |
36 |
|
37 |
} |