Java Swing O Reilly protected Color borderSelectionColor protected (Jetty web server)

Java Swing O Reilly protected Color borderSelectionColor protected transient Icon closedIcon protected transient Icon leafIcon protected transient Icon openIcon protected Color textNonSelectionColor protected Color textSelectionColor These fields store the values for their respective properties. protected boolean selected This field tracks whether or not the cell is currently selected. 17.7.2.4 Rendering Methods Beyond simple property accessors and mutators, you will find two other methods in this class that help display the cell the way you would expect. public void paint(Graphics g) This overridden method paints the background for a cell based on its selected status. public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) This method comes from the TreeCellRenderer interface. It returns the actual Component that will be used to display the cell. The various parameters to the method configure the cell renderer and are discussed in more detail later. 17.7.3 Custom Renderers Now let’s look at writing our own renderer. Our expression tree uses the default folder and leaf icons, which are more appropriate to files and filesystems. We can write a more formal renderer that uses a nice big monospaced font and does away with the little folder icons on the operators. Figure 17.12 shows the results. Figure 17.12. Expression tree with a custom renderer 17.7.4 The TreeCellRenderer Interface With this interface and your favorite Component subclass, you can render a tree cell any way you like, regardless of the look-and-feel in place. While you can return any component as a renderer, because of the problems with mixing heavyweight and lightweight components, you’ll probably - 521 -
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Leave a Reply