1 |
package skrueger.swing; |
2 |
|
3 |
import java.awt.Dimension; |
4 |
|
5 |
import javax.swing.Action; |
6 |
import javax.swing.Icon; |
7 |
import javax.swing.ImageIcon; |
8 |
import javax.swing.JButton; |
9 |
|
10 |
/** |
11 |
* An Ok {@link JButton} without text, but with an expressive {@link Icon} that |
12 |
* symbolizes OK |
13 |
* |
14 |
* @author <a href="mailto:[email protected]">Stefan Alfons Krüger</a> |
15 |
*/ |
16 |
public class OkButton extends JButton { |
17 |
|
18 |
public static final Icon ICON_OK_SMALL = new ImageIcon(OkButton.class |
19 |
.getResource("small/ok.png")); |
20 |
|
21 |
private static final Dimension DIMENSION = new Dimension(35, 25); |
22 |
|
23 |
/** |
24 |
* Creates a {@link JButton} with an icon that symbolizes OK |
25 |
*/ |
26 |
public OkButton() { |
27 |
super(ICON_OK_SMALL); |
28 |
setMaximumSize(DIMENSION); |
29 |
} |
30 |
|
31 |
/** |
32 |
* Creates a {@link JButton} with an icon that symbolizes OK |
33 |
*/ |
34 |
public OkButton(Action a) { |
35 |
super(a); |
36 |
setIcon(ICON_OK_SMALL); |
37 |
setMaximumSize(DIMENSION); |
38 |
} |
39 |
} |