This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enabling/Disabling Rows in JTable

 
pothineni rajesh
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Small Code snippet for enabling/disabling rows in a Table
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find this an interesting read.
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by disabling? Making the row not selectable, or making each cell of the row not editable?

The latter is quite easy: check TableModel.isCellEditable.
 
pothineni rajesh
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:What do you mean by disabling? Making the row not selectable, or making each cell of the row not editable?

The latter is quite easy: check TableModel.isCellEditable.


Hi,

I want to make the row not selectable based on some parameters not the cell.
Thank you in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out JTable.setSelectionModel in combination with the ListSelectionModel interface. With the addSelectionInterval and insertSelectionInterval methods you determine what rows / columns are actually selected.

Perhaps the easiest way is to wrap the default selection model:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic