File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Row Selection in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Row Selection in JTable" Watch "Row Selection in JTable" New topic

Row Selection in JTable

Suhas Mohamedali

Joined: Jun 05, 2012
Posts: 29
I want to prevent selecting another row of JTable if the ' mainAction ' is equal to Actions.CHILDCHANGED OR Actions.MODIFIED
I am able to show the Error Dialog while selecting another row but once the dialog is closed it is selecting the pointed row.
I want to select the edited row once the error dialogue is closed.

Please help.

m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 174
no ideas from code posted here, for better help sooner post an SSCCE, short, runnable, compilable, just about a.m. issues
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
also can't help with a way based on the posted code, but a global way might be
to use an AWTEventListener (mouse event mask) to do:
1) get the component clicked on
2) if the table, and if(mainAction == Actions.CHILDCHANGED || mainAction == Actions.MODIFIED),
consume the event
I agree. Here's the link:
subject: Row Selection in JTable
It's not a secret anymore!