58 * <code>revalidate</code> message would be
59 * passed up the hierarchy of the container to determine whether any other
60 * components would be affected.
61 * As the renderer is only parented for the lifetime of a painting operation
62 * we similarly want to avoid the overhead associated with walking the
63 * hierarchy for painting operations.
64 * So this class
65 * overrides the <code>validate</code>, <code>invalidate</code>,
66 * <code>revalidate</code>, <code>repaint</code>, and
67 * <code>firePropertyChange</code> methods to be
68 * no-ops and override the <code>isOpaque</code> method solely to improve
69 * performance. If you write your own renderer,
70 * please keep this performance consideration in mind.
71 * <p>
72 *
73 * <strong>Warning:</strong>
74 * Serialized objects of this class will not be compatible with
75 * future Swing releases. The current serialization support is
76 * appropriate for short term storage or RMI between applications running
77 * the same version of Swing. As of 1.4, support for long term storage
78 * of all JavaBeans™
79 * has been added to the <code>java.beans</code> package.
80 * Please see {@link java.beans.XMLEncoder}.
81 *
82 * @author Philip Milne
83 * @see JTable
84 */
85 @SuppressWarnings("serial") // Same-version serialization only
86 public class DefaultTableCellRenderer extends JLabel
87 implements TableCellRenderer, Serializable
88 {
89
90 /**
91 * An empty <code>Border</code>. This field might not be used. To change the
92 * <code>Border</code> used by this renderer override the
93 * <code>getTableCellRendererComponent</code> method and set the border
94 * of the returned component directly.
95 */
96 private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
97 private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
98 /**
375 */
376 protected void setValue(Object value) {
377 setText((value == null) ? "" : value.toString());
378 }
379
380
381 /**
382 * A subclass of <code>DefaultTableCellRenderer</code> that
383 * implements <code>UIResource</code>.
384 * <code>DefaultTableCellRenderer</code> doesn't implement
385 * <code>UIResource</code>
386 * directly so that applications can safely override the
387 * <code>cellRenderer</code> property with
388 * <code>DefaultTableCellRenderer</code> subclasses.
389 * <p>
390 * <strong>Warning:</strong>
391 * Serialized objects of this class will not be compatible with
392 * future Swing releases. The current serialization support is
393 * appropriate for short term storage or RMI between applications running
394 * the same version of Swing. As of 1.4, support for long term storage
395 * of all JavaBeans™
396 * has been added to the <code>java.beans</code> package.
397 * Please see {@link java.beans.XMLEncoder}.
398 */
399 @SuppressWarnings("serial") // Same-version serialization only
400 public static class UIResource extends DefaultTableCellRenderer
401 implements javax.swing.plaf.UIResource
402 {
403 }
404
405 }
|
58 * <code>revalidate</code> message would be
59 * passed up the hierarchy of the container to determine whether any other
60 * components would be affected.
61 * As the renderer is only parented for the lifetime of a painting operation
62 * we similarly want to avoid the overhead associated with walking the
63 * hierarchy for painting operations.
64 * So this class
65 * overrides the <code>validate</code>, <code>invalidate</code>,
66 * <code>revalidate</code>, <code>repaint</code>, and
67 * <code>firePropertyChange</code> methods to be
68 * no-ops and override the <code>isOpaque</code> method solely to improve
69 * performance. If you write your own renderer,
70 * please keep this performance consideration in mind.
71 * <p>
72 *
73 * <strong>Warning:</strong>
74 * Serialized objects of this class will not be compatible with
75 * future Swing releases. The current serialization support is
76 * appropriate for short term storage or RMI between applications running
77 * the same version of Swing. As of 1.4, support for long term storage
78 * of all JavaBeans
79 * has been added to the <code>java.beans</code> package.
80 * Please see {@link java.beans.XMLEncoder}.
81 *
82 * @author Philip Milne
83 * @see JTable
84 */
85 @SuppressWarnings("serial") // Same-version serialization only
86 public class DefaultTableCellRenderer extends JLabel
87 implements TableCellRenderer, Serializable
88 {
89
90 /**
91 * An empty <code>Border</code>. This field might not be used. To change the
92 * <code>Border</code> used by this renderer override the
93 * <code>getTableCellRendererComponent</code> method and set the border
94 * of the returned component directly.
95 */
96 private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
97 private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
98 /**
375 */
376 protected void setValue(Object value) {
377 setText((value == null) ? "" : value.toString());
378 }
379
380
381 /**
382 * A subclass of <code>DefaultTableCellRenderer</code> that
383 * implements <code>UIResource</code>.
384 * <code>DefaultTableCellRenderer</code> doesn't implement
385 * <code>UIResource</code>
386 * directly so that applications can safely override the
387 * <code>cellRenderer</code> property with
388 * <code>DefaultTableCellRenderer</code> subclasses.
389 * <p>
390 * <strong>Warning:</strong>
391 * Serialized objects of this class will not be compatible with
392 * future Swing releases. The current serialization support is
393 * appropriate for short term storage or RMI between applications running
394 * the same version of Swing. As of 1.4, support for long term storage
395 * of all JavaBeans
396 * has been added to the <code>java.beans</code> package.
397 * Please see {@link java.beans.XMLEncoder}.
398 */
399 @SuppressWarnings("serial") // Same-version serialization only
400 public static class UIResource extends DefaultTableCellRenderer
401 implements javax.swing.plaf.UIResource
402 {
403 }
404
405 }
|