This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "JTable" Watch "JTable" New topic
Author

JTable

Sankaran Krishnan
Greenhorn

Joined: Jun 27, 2001
Posts: 4
I just want to do disable selection of a particular row.
Also I have list of rows out of multiple selection.
I want to disable selection for those rows and grey
them. Trying to find a solution.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Sankaran,
IMO, you would need to subclass the DefaultTableModel in order to stop editting. Something like the following:

I am not exactly sure how to perform what you want, but this could be a start.
Regards,
Manfred.
Sankaran Krishnan
Greenhorn

Joined: Jun 27, 2001
Posts: 4
Originally posted by Manfred Leonhardt:
[B]Hi Sankaran,
IMO, you would need to subclass the DefaultTableModel in order to stop editting. Something like the following:

I am not exactly sure how to perform what you want, but this could be a start.
Regards,
Manfred.[/B]

Sankaran Krishnan
Greenhorn

Joined: Jun 27, 2001
Posts: 4
I just want disable a row and grey the selectedRow. Then onwards I don't want that row to be selected. Is there a exact solution for it.
mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
Hi Krishnan
I think you can solve this problem round about way.
I am assuming that you are using JTable which uses AbstractTableModel.
To Make a gray row, you can do by extending DefaultTableCellRenderer, And you need to keep this row number.
Just allow multiple selection(No Problem Gray row can be selected)When you do some processing with multiple selected rows, Just neglect gray row(You know row numbers which are grayed), This process has to be done in class which extends AbstractTableModel..
This is just a concept in my mind. I am not sure this is what your looking for..
Mohana

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JTable
 
Similar Threads
multi select boxes
Page Navigation
How to disable the selection of rows in JTable per Mouse Dragging?
Designing menu item State
Disabling a field in java script