Jetty web server - Java Swing O Reilly } 17.7.2 The DefaultTreeCellRenderer

Java Swing O Reilly } 17.7.2 The DefaultTreeCellRenderer Class The JDK1.2 beta4 release introduced another alternative to the look-and-feel setup for trees. In addition to setting up icons and line styles as we do in the previous example, you can use the DefaultTreeCellRenderer class and its properties to customize tree display. DefaultTreeCellRenderer is an extension of the JLabel class that implements the TreeCellRenderer interface (discussed later), and is devoted to making your tree appear on screen the way you want it to look. 17.7.2.1 Properties Table 17.15 shows the properties associated with this new class: Table 17.15, DefaultTreeCellRenderer Properties Property Data Type get is set bound Default Value background*[5] Color From L&F backgroundNonSelectionColor Color From L&F backgroundSelectionColor Color From L&F borderSelectionColor Color From L&F closedIcon Icon From L&F defaultClosedIcon Icon From L&F defaultLeafIcon Icon From L&F defaultOpenIcon Icon From L&F font*[5] Font From L&F leafIcon Icon From L&F openIcon Icon From L&F preferredSize*[6] Dimension From L&F textNonSelectionColor Color From L&F textSelectionColor Color From L&F [5] This property has an overridden set() method that does not allow UIResource objects (such as ColorUIResource and FontUIResource) as its argument. [6] This property overrides the get() method to increase the width of the preferred size by 3 pixels. The various properties let you configure the icons to use for leaves, open folders and closed folders. You can also control the colors used for the text and selected cells. 17.7.2.2 Constructors The DefaultTreeCellRenderer class has only one constructor: public DefaultTreeCellRenderer() This constructor simply returns a new instance of the class. 17.7.2.3 Fields protected Color backgroundNonSelectionColor protected Color backgroundSelectionColor - 520 -
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Leave a Reply