1 /*
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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 public class DefaultTableCellRenderer extends JLabel
86 implements TableCellRenderer, Serializable
87 {
88
89 /**
90 * An empty <code>Border</code>. This field might not be used. To change the
91 * <code>Border</code> used by this renderer override the
92 * <code>getTableCellRendererComponent</code> method and set the border
93 * of the returned component directly.
94 */
95 private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
96 private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
97 protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
98
99 // We need a place to store the color the JLabel should be returned
100 // to after its foreground and background colors have been set
101 // to the selection background color.
102 // These ivars will be made protected when their names are finalized.
103 private Color unselectedForeground;
104 private Color unselectedBackground;
374
375
376 /**
377 * A subclass of <code>DefaultTableCellRenderer</code> that
378 * implements <code>UIResource</code>.
379 * <code>DefaultTableCellRenderer</code> doesn't implement
380 * <code>UIResource</code>
381 * directly so that applications can safely override the
382 * <code>cellRenderer</code> property with
383 * <code>DefaultTableCellRenderer</code> subclasses.
384 * <p>
385 * <strong>Warning:</strong>
386 * Serialized objects of this class will not be compatible with
387 * future Swing releases. The current serialization support is
388 * appropriate for short term storage or RMI between applications running
389 * the same version of Swing. As of 1.4, support for long term storage
390 * of all JavaBeans™
391 * has been added to the <code>java.beans</code> package.
392 * Please see {@link java.beans.XMLEncoder}.
393 */
394 public static class UIResource extends DefaultTableCellRenderer
395 implements javax.swing.plaf.UIResource
396 {
397 }
398
399 }
|
1 /*
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
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 protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
99
100 // We need a place to store the color the JLabel should be returned
101 // to after its foreground and background colors have been set
102 // to the selection background color.
103 // These ivars will be made protected when their names are finalized.
104 private Color unselectedForeground;
105 private Color unselectedBackground;
375
376
377 /**
378 * A subclass of <code>DefaultTableCellRenderer</code> that
379 * implements <code>UIResource</code>.
380 * <code>DefaultTableCellRenderer</code> doesn't implement
381 * <code>UIResource</code>
382 * directly so that applications can safely override the
383 * <code>cellRenderer</code> property with
384 * <code>DefaultTableCellRenderer</code> subclasses.
385 * <p>
386 * <strong>Warning:</strong>
387 * Serialized objects of this class will not be compatible with
388 * future Swing releases. The current serialization support is
389 * appropriate for short term storage or RMI between applications running
390 * the same version of Swing. As of 1.4, support for long term storage
391 * of all JavaBeans™
392 * has been added to the <code>java.beans</code> package.
393 * Please see {@link java.beans.XMLEncoder}.
394 */
395 @SuppressWarnings("serial") // Same-version serialization only
396 public static class UIResource extends DefaultTableCellRenderer
397 implements javax.swing.plaf.UIResource
398 {
399 }
400
401 }
|