45 |
|
|
46 |
import javax.swing.AbstractButton; |
import javax.swing.AbstractButton; |
47 |
import javax.swing.ButtonModel; |
import javax.swing.ButtonModel; |
48 |
|
import javax.swing.JButton; |
49 |
import javax.swing.JInternalFrame; |
import javax.swing.JInternalFrame; |
50 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
51 |
import javax.swing.JMenuBar; |
import javax.swing.JMenuBar; |
52 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
53 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
54 |
|
import javax.swing.JScrollPane; |
55 |
import javax.swing.JTextField; |
import javax.swing.JTextField; |
56 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
57 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
67 |
|
|
68 |
|
|
69 |
/** |
/** |
70 |
* This factory class creates borders for the different Swing components |
* A factory class that creates borders for the different Swing components. |
|
* UI. |
|
71 |
* |
* |
72 |
* @author Roman Kennke (roman@kennke.org) |
* @author Roman Kennke (roman@kennke.org) |
73 |
*/ |
*/ |
89 |
/** The shared instance for getTextFieldBorder(). */ |
/** The shared instance for getTextFieldBorder(). */ |
90 |
private static Border textFieldBorder; |
private static Border textFieldBorder; |
91 |
|
|
92 |
/** |
/** The shared instance for getTextBorder(). */ |
|
* The shared instance for getTextBorder(). |
|
|
*/ |
|
93 |
private static Border textBorder; |
private static Border textBorder; |
94 |
|
|
95 |
/** The shared instance for getRolloverBorder(). */ |
/** The shared instance for getRolloverBorder(). */ |
103 |
private static BasicBorders.MarginBorder marginBorder; |
private static BasicBorders.MarginBorder marginBorder; |
104 |
|
|
105 |
/** |
/** |
106 |
* The border that is drawn around Swing buttons. |
* A border used for {@link JButton} components. |
107 |
*/ |
*/ |
108 |
public static class ButtonBorder extends AbstractBorder implements UIResource |
public static class ButtonBorder extends AbstractBorder implements UIResource |
109 |
{ |
{ |
111 |
protected static Insets borderInsets = new Insets(3, 3, 3, 3); |
protected static Insets borderInsets = new Insets(3, 3, 3, 3); |
112 |
|
|
113 |
/** |
/** |
114 |
* Creates a new instance of ButtonBorder. |
* Creates a new instance of <code>ButtonBorder</code>. |
115 |
*/ |
*/ |
116 |
public ButtonBorder() |
public ButtonBorder() |
117 |
{ |
{ |
185 |
} |
} |
186 |
|
|
187 |
/** |
/** |
188 |
* Returns the insets of the ButtonBorder. |
* Returns the insets of the <code>ButtonBorder</code>. |
189 |
* |
* |
190 |
* @param c the component for which the border is used |
* @param c the component for which the border is used |
191 |
* |
* |
192 |
* @return the insets of the ButtonBorder |
* @return The insets of the ButtonBorder |
193 |
*/ |
*/ |
194 |
public Insets getBorderInsets(Component c) |
public Insets getBorderInsets(Component c) |
195 |
{ |
{ |
197 |
} |
} |
198 |
|
|
199 |
/** |
/** |
200 |
* Returns the insets of the ButtonBorder in the specified Insets object. |
* Returns the insets of the <code>ButtonBorder</code> in the specified |
201 |
|
* <code>newInsets</code> object. |
202 |
* |
* |
203 |
* @param c the component for which the border is used |
* @param c the component for which the border is used |
204 |
* @param newInsets the insets object where to put the values |
* @param newInsets the insets object where to put the values (if |
205 |
|
* <code>null</code>, a new instance is created). |
206 |
* |
* |
207 |
* @return the insets of the ButtonBorder |
* @return The insets. |
208 |
*/ |
*/ |
209 |
public Insets getBorderInsets(Component c, Insets newInsets) |
public Insets getBorderInsets(Component c, Insets newInsets) |
210 |
{ |
{ |
211 |
if (newInsets == null) |
if (newInsets == null) |
212 |
newInsets = new Insets(0, 0, 0, 0); |
newInsets = new Insets(0, 0, 0, 0); |
213 |
|
|
|
AbstractButton b = (AbstractButton) c; |
|
214 |
newInsets.bottom = borderInsets.bottom; |
newInsets.bottom = borderInsets.bottom; |
215 |
newInsets.left = borderInsets.left; |
newInsets.left = borderInsets.left; |
216 |
newInsets.right = borderInsets.right; |
newInsets.right = borderInsets.right; |
488 |
} |
} |
489 |
|
|
490 |
/** |
/** |
491 |
* A border used when painting {@link JInternalFrame} instances. |
* A border used for the {@link JInternalFrame} component. |
492 |
*/ |
*/ |
493 |
public static class InternalFrameBorder extends AbstractBorder |
public static class InternalFrameBorder extends AbstractBorder |
494 |
implements UIResource |
implements UIResource |
587 |
} |
} |
588 |
|
|
589 |
/** |
/** |
590 |
* A border used when painting {@link JInternalFrame} instances that are |
* A border used for {@link JInternalFrame} components that are |
591 |
* presented as dialogs (by the {@link JOptionPane} class). |
* presented as dialogs (by the {@link JOptionPane} class). |
592 |
*/ |
*/ |
593 |
public static class OptionDialogBorder extends AbstractBorder |
public static class OptionDialogBorder extends AbstractBorder |
863 |
} |
} |
864 |
|
|
865 |
/** |
/** |
866 |
* A border for JScrollPanes. |
* A border for {@link JScrollPane} components. |
867 |
*/ |
*/ |
868 |
public static class ScrollPaneBorder |
public static class ScrollPaneBorder |
869 |
extends AbstractBorder |
extends AbstractBorder |
1116 |
} |
} |
1117 |
|
|
1118 |
/** |
/** |
1119 |
* A border used for {@link JToggleButton} components. |
* A border used for the {@link JToggleButton} component. |
1120 |
* |
* |
1121 |
* @since 1.3 |
* @since 1.3 |
1122 |
*/ |
*/ |
1209 |
} |
} |
1210 |
|
|
1211 |
/** |
/** |
1212 |
* A border used when painting {@link JToolBar} instances. |
* A border used for the {@link JToolBar} component. |
1213 |
*/ |
*/ |
1214 |
public static class ToolBarBorder extends AbstractBorder |
public static class ToolBarBorder extends AbstractBorder |
1215 |
implements UIResource, SwingConstants |
implements UIResource, SwingConstants |