Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JTable: edit by typing directly into cell, Return doesn't commit change? (1.4.2)



I'm having a problem with the Return key failing to commit values in JTables under Java 1.4.2 on the Mac.

Here's how it fails:
- Create a JTable.
- Click (don't double-click, just click) in a cell.
- Start typing. You enter edit mode immediately. Type a few characters.
- Hit <Return>. The value that you typed in NOT committed, and the selection does not move. You have to click on another cell, hit an arrow key, or do something else to commit the change.

I expected <Return> to commit the change, and for the selection to mode to the next row.

In contrast, if you enter cell editing mode by *double*-clicking on a cell, things work fine.

Here's a simple code snippet which allows you to see the problem:

import javax.swing.*;
public class TableTest
{
public static void main(String[] args)
{
JTable table = new JTable(10, 10);
JScrollPane sp = new JScrollPane(table);
JFrame frame = new JFrame();
frame.getContentPane().add(sp);
frame.setSize(200, 200);
frame.setVisible(true);
}
}

The problem doesn't appear in Java 1.4.1 on Mac, and doesn't appear on Java 1.4.2 on other platforms.

Any thoughts, suggestions, workarounds?

Thanks,
--
Bob Gilmore, Senior Software Engineer,
The MathWorks, Inc.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.