1 |
alfonx |
244 |
/******************************************************************************* |
2 |
|
|
* Copyright (c) 2009 Martin O. J. Schmitz. |
3 |
|
|
* |
4 |
|
|
* This file is part of the SCHMITZM library - a collection of utility |
5 |
|
|
* classes based on Java 1.6, focussing (not only) on Java Swing |
6 |
|
|
* and the Geotools library. |
7 |
|
|
* |
8 |
|
|
* The SCHMITZM project is hosted at: |
9 |
|
|
* http://wald.intevation.org/projects/schmitzm/ |
10 |
|
|
* |
11 |
|
|
* This program is free software; you can redistribute it and/or |
12 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
13 |
|
|
* as published by the Free Software Foundation; either version 3 |
14 |
|
|
* of the License, or (at your option) any later version. |
15 |
|
|
* |
16 |
|
|
* This program is distributed in the hope that it will be useful, |
17 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
|
|
* GNU General Public License for more details. |
20 |
|
|
* |
21 |
|
|
* You should have received a copy of the GNU Lesser General Public License (license.txt) |
22 |
|
|
* along with this program; if not, write to the Free Software |
23 |
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
|
|
* or try this link: http://www.gnu.org/licenses/lgpl.html |
25 |
|
|
* |
26 |
|
|
* Contributors: |
27 |
|
|
* Martin O. J. Schmitz - initial API and implementation |
28 |
|
|
* Stefan A. Krüger - additional utility classes |
29 |
|
|
******************************************************************************/ |
30 |
|
|
package skrueger.swing; |
31 |
|
|
|
32 |
|
|
import java.awt.Dimension; |
33 |
|
|
|
34 |
|
|
import javax.swing.Action; |
35 |
|
|
import javax.swing.Icon; |
36 |
|
|
import javax.swing.ImageIcon; |
37 |
|
|
import javax.swing.JButton; |
38 |
|
|
/** |
39 |
|
|
* A Cancel {@link JButton} without text, but with an expressive {@link Icon} |
40 |
|
|
* stat symbolizes CANCEL |
41 |
|
|
* |
42 |
|
|
* @author Stefan Alfons Krüger |
43 |
|
|
* |
44 |
|
|
*/ |
45 |
|
|
public class CancelButton extends JButton { |
46 |
|
|
public static final Icon ICON_CANCEL_SMALL = new ImageIcon( CancelButton.class.getResource("small/cancel.png") ); |
47 |
|
|
|
48 |
|
|
private static final Dimension DIMENSION = new Dimension(35,25); |
49 |
|
|
|
50 |
|
|
/** |
51 |
|
|
* Creates a {@link JButton} with an icon that symbolizes OK |
52 |
|
|
*/ |
53 |
|
|
public CancelButton() { |
54 |
|
|
super(ICON_CANCEL_SMALL); |
55 |
|
|
setMaximumSize(DIMENSION); |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
/** |
59 |
|
|
* Creates a {@link JButton} with an icon that symbolizes OK |
60 |
|
|
*/ |
61 |
|
|
public CancelButton(Action a) { |
62 |
|
|
super(a); |
63 |
|
|
setIcon(ICON_CANCEL_SMALL); |
64 |
|
|
setMaximumSize(DIMENSION); |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
} |