• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

changeSelection worked in 1.4, fails in 1.5

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic