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 |
* A Cancel {@link JButton} without text, but with an expressive {@link Icon} |
11 |
* stat symbolizes CANCEL |
12 |
* |
13 |
* @author Stefan Alfons Krüger |
14 |
* |
15 |
*/ |
16 |
public class CancelButton extends JButton { |
17 |
public static final Icon ICON_CANCEL_SMALL = new ImageIcon( CancelButton.class.getResource("small/cancel.png") ); |
18 |
|
19 |
private static final Dimension DIMENSION = new Dimension(35,25); |
20 |
|
21 |
/** |
22 |
* Creates a {@link JButton} with an icon that symbolizes OK |
23 |
*/ |
24 |
public CancelButton() { |
25 |
super(ICON_CANCEL_SMALL); |
26 |
setMaximumSize(DIMENSION); |
27 |
} |
28 |
|
29 |
/** |
30 |
* Creates a {@link JButton} with an icon that symbolizes OK |
31 |
*/ |
32 |
public CancelButton(Action a) { |
33 |
super(a); |
34 |
setIcon(ICON_CANCEL_SMALL); |
35 |
setMaximumSize(DIMENSION); |
36 |
} |
37 |
|
38 |
|
39 |
} |