Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

changeSelection worked in 1.4, fails in 1.5  RSS feed

 
Brett Carver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The application I'm working on has a search function for a large table of data. In addition, you can restrict the search to a selected area of the table. This worked fine when compiled on Java 1.4 (1.4.2_06), but has stopped working on Java 1.5 (1.5.0_03). It appears the problem is with JTable.changeSelection() not actually changing the selection to the cell that was found in the search.

I've been able to reproduce the problem with some small modifications to the SimpleTableSelectionDemo.java tutorial program. I've included the code below with my changes.

Basically all I did was modify the mouseListener so that instead of printing the table contents, it calls changeSelection to a fixed location (simulating the search going to a matching cell).

If I compile/run in 1.4, I can select a cell or region, right-click the mouse and see the specified cell selected. If I start typing the selected cell is edited.

If I compile/run in 1.5, when I right-click the selected cell is not changed (the second selected cell of the select region stays selected). If I start typing the wrong cell is edited.

Hopefully someone can tell me if this is a pilot error, a run-time bug, or a change in behavior (and what I need to do to get it working again in 1.5).

Thanks.

 
Brett Carver
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well it's been a while with no replies. Can anyone help me here? Is there a change in behavior (I need to "fix" my code) or is there are true problem with Java 1.5?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!