classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: JTable cell editing implemented and committed


From: Anthony Balkissoon
Subject: [cp-patches] FYI: JTable cell editing implemented and committed
Date: Tue, 09 Aug 2005 12:00:26 -0400

This patch implements DefaultCellEditor and some methods in JTable in
order to make editing JTable cells possible.

A demo will be added shortly, for now I am attaching a small test app
that you can use to test the editing functionality.  With a table cell
selected, pressing F2 starts editing and then pressing ENTER stops
editing.

2 notes:
- the test app appears to draw incorrectly at the top, this is due to
some trouble in BasicViewportUI
- if you edit more than one cell, you will notice that text from
previously edited cells appears in the cell you are currently editing,
this is due to bugs in JTextField/JTextComponent

Patch is attached.

2005-08-09  Anthony Balkissoon  <address@hidden>

        * javax/swing/DefaultCellEditor.java:
        (EditorDelegate.setValue): Implemented.
        (EditorDelegate.getCellEditorValue): Implemented.
        (EditorDelegate.isCellEditable): Implemented.
        (EditorDelegate.shouldSelectCell): Implemented.
        (EditorDelegate.stopCellEditing): Implemented.
        (EditorDelegate.cancelCellEditing): Implemented.
        (EditorDelegate.startCellEditing): Implemented.
        (EditorDelegate.actionPerformed): Implemented.
        (EditorDelegate.itemStateChanged): Implemented.
        (EditorDelegate.fireEditingStopped): New implementation method.
        (EditorDelegate.fireEditingCancelled): New implementation method.
        (DefaultCellEditor): Implemented 3 constructors.
        (getComponent): Implemented.
        (getClickCountToStart): Implemented.
        (setClickCountToStart): Implemented.
        (getCellEditorValue): Implemented.
        (isCellEditable): Implemented.
        (shouldSelectCell): Implemented.
        (cancelCellEditing): Implemented.
        (getTableCellEditorComponent): Implemented.
        * javax/swing/JTable.java:
        (EditorUpdateTimer): New private class.
        (editingStopped): Implemented.
        (setValueAt): If the Object value is a Component, add it to the JTable
        so it can obtain focus.
        (editCellAt): Implemented.
        (removeEditor): Implemented.
        (prepareEditor): Implemented.
        * javax/swing/plaf/basic/BasicTableUI.java:
        (KeyHandler.keyPressed): Added F2 "start editing" key action.
        (MouseHandler.mousePressed): Added check to see if a new cell was
        selected and we need to stop editing.
        (paint): If the cell is a JTextField, paint its Caret as well.
        * javax/swing/table/DefaultTableCellRenderer.java:
        (getTableCellRendererComponent): If a JTextField is passed in, return
        one.  This is used for editing JTable cells.

Attachment: JTableEditing.diff
Description: Text Data

Attachment: Test.java
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]