Java Swing - (Business web hosting) O Reilly public abstract boolean isCellEditable(EventObject
Java Swing - O Reilly public abstract boolean isCellEditable(EventObject anEvent) Should return true if anEvent is a valid trigger for starting this kind of editor. For example, if you want the user to double click on a field to invoke the editor, this method would test whether anEvent is a double click mouse event. If it was only a single click, you could return false. If it was a double click, you could return true. public abstract boolean shouldSelectCell(EventObject anEvent) This method should return true if the cell to be edited should also be selected. While you usually want to select the cell, there are some situations in which not selecting the cell is preferable. For example, you might be implementing a table that lets the user edit cells that are part of an ongoing selection. Since you want the selection to remain in place, you would implement this method to return false. The cell can still be edited. public abstract boolean stopCellEditing() public abstract void cancelCellEditing() You should use these methods to tell the editor to stop editing the cell. The stopCellEditing() method indicates that editing is over and the new value supplied should replace the old value of the cell. The cancelCellEditing() method indicates editing is over and the new value the user entered (if any) should be ignored. The stopCellEditing() method can return a false value if the editor is unable to stop editing. (This might occur if your editor validates input and currently contains an invalid entry.) As an example, you can use these to programmatically stop or cancel editing before starting to edit another cell or upon losing focus. 27.2.3 The CellEditorListener Interface The CellEditorListener interface defines how an object can listen for events generated by a cell editor. Cell editors generate a ChangeEvent when editing is canceled or stopped (a better term might be “finished”). Typically, the object “hosting” the editor (for example, a JTree allowing the user to enter a new filename) would register as a listener. When the event occurs, the JTree would read the cell’s new value from the editor, tear down the editor, and repaint the cell with its new value. public void editingStopped(ChangeEvent e) Indicates successful editing has been completed. You can get the new value of the cell from the editor component, which is contained in the source property of the change event. public void editingCanceled(ChangeEvent e) Indicates that editing has been canceled. You should ignore any partially edited value that might be present in the editor. 27.2.4 The DefaultCellEditor Class Swing provides a default editor with a fair amount of flexibility. The DefaultCellEditor class implements the CellEditor interface and provides constructors that let you use a text field, check box, or combo box for entering the new value. - 925
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.