![]() This code was broken by 1.3 because of changes in the way focus was handled. In Java 1.2 I subclassed JTable and in my version added a focus listener that, when the table lost focus, checked if a cell was being edited and if so stopped the edit. Public void actionPerformed(ActionEvent e) Public class Dork extends JFrame implements ActionListener * This is, as I presume you realize, not a production-quality program. This happens when the JTable is created using either the JTable(Object data,Object heads) and JTable(TableModel tm). The user's last change is never posted to the table model. When the user clicks on something outside the JTable, I expect any udates to the current cell to be posted to the table model. This is very non-intuitive because the unposted value is nevertheless visible on the screen: it looks like the program calculated the total incorrectly. Even though the user has entered a different value in the cell, because he did not move to a different cell within the JTable before exiting the JTable completely, the update was never posted back to the table model. Change this number to a different value, but do NOT use arrow keys or tab to leave the cell and do not press enter - leave the cursor on that cell. Now select either of the two cells with numbers in them. The program displays the sum of the two numbers you have entered. This displays a JTable with 3 cells, a button labeled "Add", and a JLabel. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : When focus leaves a JTable, it should stopCellEditing on the current cell. This gives very non-intuitive behavior to the user: It looks like they've made an update, but the update is ignored. JTable should stop editing the current cell when it loses focus.Ĭurrent behavior is that if the user selects a cell and begins editing, then clicks on something outside the table, the cell shows the value they entered, but this value is never posted back to the table model. Haven't thought to check it in other OS's.) Windows 2000 Build 2195 Service Pack 4 (I've seen this bug in every version of Windows I've used. Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode) Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |