< prev index next >
src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
Print this page
*** 44,54 ****
import javax.swing.border.EmptyBorder;
import sun.swing.DefaultLookup;
/**
* Displays an entry in a tree.
! * <code>DefaultTreeCellRenderer</code> is not opaque and
* unless you subclass paint you should not change this.
* See <a
href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
* in <em>The Java Tutorial</em>
* for examples of customizing node display using this class.
--- 44,54 ----
import javax.swing.border.EmptyBorder;
import sun.swing.DefaultLookup;
/**
* Displays an entry in a tree.
! * {@code DefaultTreeCellRenderer} is not opaque and
* unless you subclass paint you should not change this.
* See <a
href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
* in <em>The Java Tutorial</em>
* for examples of customizing node display using this class.
*** 74,89 ****
* <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
* </table>
* <p>
* <strong><a name="override">Implementation Note:</a></strong>
* This class overrides
! * <code>invalidate</code>,
! * <code>validate</code>,
! * <code>revalidate</code>,
! * <code>repaint</code>,
* and
! * <code>firePropertyChange</code>
* solely to improve performance.
* If not overridden, these frequently called methods would execute code paths
* that are unnecessary for the default tree cell renderer.
* If you write your own renderer,
* take care to weigh the benefits and
--- 74,89 ----
* <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
* </table>
* <p>
* <strong><a name="override">Implementation Note:</a></strong>
* This class overrides
! * {@code invalidate},
! * {@code validate},
! * {@code revalidate},
! * {@code repaint},
* and
! * {@code firePropertyChange}
* solely to improve performance.
* If not overridden, these frequently called methods would execute code paths
* that are unnecessary for the default tree cell renderer.
* If you write your own renderer,
* take care to weigh the benefits and
*** 94,104 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Rob Davis
* @author Ray Ryan
* @author Scott Violet
--- 94,104 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Rob Davis
* @author Ray Ryan
* @author Scott Violet
*** 410,424 ****
public Color getBorderSelectionColor() {
return borderSelectionColor;
}
/**
! * Subclassed to map <code>FontUIResource</code>s to null. If
! * <code>font</code> is null, or a <code>FontUIResource</code>, this
* has the effect of letting the font of the JTree show
! * through. On the other hand, if <code>font</code> is non-null, and not
! * a <code>FontUIResource</code>, the font becomes <code>font</code>.
*/
public void setFont(Font font) {
if(font instanceof FontUIResource)
font = null;
super.setFont(font);
--- 410,424 ----
public Color getBorderSelectionColor() {
return borderSelectionColor;
}
/**
! * Subclassed to map {@code FontUIResource}s to null. If
! * {@code font} is null, or a {@code FontUIResource}, this
* has the effect of letting the font of the JTree show
! * through. On the other hand, if {@code font} is non-null, and not
! * a {@code FontUIResource}, the font becomes {@code font}.
*/
public void setFont(Font font) {
if(font instanceof FontUIResource)
font = null;
super.setFont(font);
*** 439,468 ****
}
return font;
}
/**
! * Subclassed to map <code>ColorUIResource</code>s to null. If
! * <code>color</code> is null, or a <code>ColorUIResource</code>, this
* has the effect of letting the background color of the JTree show
! * through. On the other hand, if <code>color</code> is non-null, and not
! * a <code>ColorUIResource</code>, the background becomes
! * <code>color</code>.
*/
public void setBackground(Color color) {
if(color instanceof ColorUIResource)
color = null;
super.setBackground(color);
}
/**
* Configures the renderer based on the passed in components.
* The value is set from messaging the tree with
! * <code>convertValueToText</code>, which ultimately invokes
! * <code>toString</code> on <code>value</code>.
* The foreground color is set based on the selection and the icon
! * is set based on the <code>leaf</code> and <code>expanded</code>
* parameters.
*/
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel,
boolean expanded,
--- 439,468 ----
}
return font;
}
/**
! * Subclassed to map {@code ColorUIResource}s to null. If
! * {@code color} is null, or a {@code ColorUIResource}, this
* has the effect of letting the background color of the JTree show
! * through. On the other hand, if {@code color} is non-null, and not
! * a {@code ColorUIResource}, the background becomes
! * {@code color}.
*/
public void setBackground(Color color) {
if(color instanceof ColorUIResource)
color = null;
super.setBackground(color);
}
/**
* Configures the renderer based on the passed in components.
* The value is set from messaging the tree with
! * {@code convertValueToText}, which ultimately invokes
! * {@code toString} on {@code value}.
* The foreground color is set based on the selection and the icon
! * is set based on the {@code leaf} and {@code expanded}
* parameters.
*/
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel,
boolean expanded,
*** 599,609 ****
}
return 0;
}
/**
! * Overrides <code>JComponent.getPreferredSize</code> to
* return slightly wider preferred size value.
*/
public Dimension getPreferredSize() {
Dimension retDimension = super.getPreferredSize();
--- 599,609 ----
}
return 0;
}
/**
! * Overrides {@code JComponent.getPreferredSize} to
* return slightly wider preferred size value.
*/
public Dimension getPreferredSize() {
Dimension retDimension = super.getPreferredSize();
< prev index next >