The moose likes Swing / AWT / SWT and the fly likes Editing in a JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Editing in a JTable" Watch "Editing in a JTable" New topic

Editing in a JTable

Russell Peters
Ranch Hand

Joined: Jan 25, 2006
Posts: 50
I have a JTable with its associated table model and a table model listener. I have 3 columns in it and columns 2 & 3 are editable. When the user edits column 2, I would like to access the new value that the user entered for validation purposes and if valid I update the table else throw an error dialog. I tried the , but this gives me the value that was originally there not the new value.

Currently, I have it implemented as a non editable column and the user clicks the 'Edit' button which shows up a , and therefore I have a handle to the new value.

But now I wish to get rid of the 'Edit' button altogether and make the column editable within the table itself.

Can someone help me with this?

Thanks in advance
[ August 03, 2006: Message edited by: Russell Peters ]

SCJP 1.4
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Russell Peters
Ranch Hand

Joined: Jan 25, 2006
Posts: 50
Worked like a charm !!!

Thanks Craig,

I agree. Here's the link:
subject: Editing in a JTable
It's not a secret anymore!