24 */
25 package javax.swing.plaf.basic;
26
27 import javax.swing.*;
28 import javax.swing.event.*;
29 import javax.swing.border.*;
30
31 import java.awt.*;
32
33 import java.io.Serializable;
34
35
36 /**
37 * ComboBox renderer
38 * <p>
39 * <strong>Warning:</strong>
40 * Serialized objects of this class will not be compatible with
41 * future Swing releases. The current serialization support is
42 * appropriate for short term storage or RMI between applications running
43 * the same version of Swing. As of 1.4, support for long term storage
44 * of all JavaBeans™
45 * has been added to the <code>java.beans</code> package.
46 * Please see {@link java.beans.XMLEncoder}.
47 *
48 * @author Arnaud Weber
49 */
50 @SuppressWarnings("serial") // Same-version serialization only
51 public class BasicComboBoxRenderer extends JLabel
52 implements ListCellRenderer<Object>, Serializable {
53
54 /**
55 * An empty <code>Border</code>. This field might not be used. To change the
56 * <code>Border</code> used by this renderer directly set it using
57 * the <code>setBorder</code> method.
58 */
59 protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
60 private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
61
62 /**
63 * Constructs a new instance of {@code BasicComboBoxRenderer}.
64 */
122 setIcon((Icon)value);
123 }
124 else {
125 setText((value == null) ? "" : value.toString());
126 }
127 return this;
128 }
129
130
131 /**
132 * A subclass of BasicComboBoxRenderer that implements UIResource.
133 * BasicComboBoxRenderer doesn't implement UIResource
134 * directly so that applications can safely override the
135 * cellRenderer property with BasicListCellRenderer subclasses.
136 * <p>
137 * <strong>Warning:</strong>
138 * Serialized objects of this class will not be compatible with
139 * future Swing releases. The current serialization support is
140 * appropriate for short term storage or RMI between applications running
141 * the same version of Swing. As of 1.4, support for long term storage
142 * of all JavaBeans™
143 * has been added to the <code>java.beans</code> package.
144 * Please see {@link java.beans.XMLEncoder}.
145 */
146 @SuppressWarnings("serial") // Same-version serialization only
147 public static class UIResource extends BasicComboBoxRenderer implements javax.swing.plaf.UIResource {
148 }
149 }
|
24 */
25 package javax.swing.plaf.basic;
26
27 import javax.swing.*;
28 import javax.swing.event.*;
29 import javax.swing.border.*;
30
31 import java.awt.*;
32
33 import java.io.Serializable;
34
35
36 /**
37 * ComboBox renderer
38 * <p>
39 * <strong>Warning:</strong>
40 * Serialized objects of this class will not be compatible with
41 * future Swing releases. The current serialization support is
42 * appropriate for short term storage or RMI between applications running
43 * the same version of Swing. As of 1.4, support for long term storage
44 * of all JavaBeans
45 * has been added to the <code>java.beans</code> package.
46 * Please see {@link java.beans.XMLEncoder}.
47 *
48 * @author Arnaud Weber
49 */
50 @SuppressWarnings("serial") // Same-version serialization only
51 public class BasicComboBoxRenderer extends JLabel
52 implements ListCellRenderer<Object>, Serializable {
53
54 /**
55 * An empty <code>Border</code>. This field might not be used. To change the
56 * <code>Border</code> used by this renderer directly set it using
57 * the <code>setBorder</code> method.
58 */
59 protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
60 private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
61
62 /**
63 * Constructs a new instance of {@code BasicComboBoxRenderer}.
64 */
122 setIcon((Icon)value);
123 }
124 else {
125 setText((value == null) ? "" : value.toString());
126 }
127 return this;
128 }
129
130
131 /**
132 * A subclass of BasicComboBoxRenderer that implements UIResource.
133 * BasicComboBoxRenderer doesn't implement UIResource
134 * directly so that applications can safely override the
135 * cellRenderer property with BasicListCellRenderer subclasses.
136 * <p>
137 * <strong>Warning:</strong>
138 * Serialized objects of this class will not be compatible with
139 * future Swing releases. The current serialization support is
140 * appropriate for short term storage or RMI between applications running
141 * the same version of Swing. As of 1.4, support for long term storage
142 * of all JavaBeans
143 * has been added to the <code>java.beans</code> package.
144 * Please see {@link java.beans.XMLEncoder}.
145 */
146 @SuppressWarnings("serial") // Same-version serialization only
147 public static class UIResource extends BasicComboBoxRenderer implements javax.swing.plaf.UIResource {
148 }
149 }
|