Fedora web server - Java Swing O Reilly 17.7.6 The TreeCellEditor Interface
Java Swing O Reilly 17.7.6 The TreeCellEditor Interface Like the TreeCellRenderer interface, the TreeCellEditor interface has one method: public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row) Allows you to configure the editor just before it pops up on the screen. In our example, we use this method to select the current operator in the combo box or to set the current text value for the text field. In addition to this method, you also need to keep track of things like whether or not you can even edit this tree node. Most of that information will come from the CellEditor interface (which TreeCellEditor extends). 17.7.7 The DefaultTreeCellEditor Class The JDK1.2 beta4 release gives us another useful addition to the tree package: the DefaultTreeCellEditor class. This class can be used to supply an editor for your tree cells that lets icons associated with the cells remain. (That was a problem in previous releases.) You can use a default text field to edit cells, or you can wrap your own custom editor in this class to make use of the start-up and rendering features. The DefaultTreeCellEditor class will start editing a cell after a triple-click of the mouse, or after a “click-pause-click wait for 1200 milliseconds” sequence. 17.7.7.1 Properties The DefaultTreeCellEditor properties are shown below in Table 17.16: Table 17.16, DefaultTreeCellEditor Properties Property Data Type get is set bound Default Value borderSelectionColor Color from L&F cellEditorValue* Object font* Font from L&F tree[7] JTree from constructor [7] This property has a protected set() method. The font and borderSelectionColor properties determine the visible qualities of the editor. The cellEditorValue property comes from the CellEditor interface discussed in detail in Chapter 27. (It just contains the current value stored in the editor.) The tree property is the JTree whose cell is being edited. 17.7.7.2 Events As dictated by the CellEditor interface, the DefaultTreeCellEditor class generates ChangeEvent objects for cell editor events. The usual add and remove methods are present: public void addCellEditorListener() public void removeCellEditorListener() - 524 -
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.