This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Verify input in jTable except for head row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Verify input in jTable except for head row" Watch "Verify input in jTable except for head row" New topic

Verify input in jTable except for head row

Viktoria Silver

Joined: Jul 01, 2010
Posts: 6

I have a jTable with doubles or integers in every cell except for the top row, which can be user changed too, but can contain anything.
How can I validate user input for it being a numeric value?

I know there is an approach like this:

but if I use this on every column the top row will be restricted to.
Maybe there there is a way for validating rows instead of columns?

Thank you, all help appreciated!
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2372
Override the table method getCellEditor(...). If the row is 0, return a default editor otherwise return super.getCellEditor()
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Verify input in jTable except for head row
jQuery in Action, 3rd edition