File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Register / Login


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

Verify input in jTable except for head row

Viktoria Silver
Greenhorn

Joined: Jul 01, 2010
Posts: 6
Hi.

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:
table.getColumnModel().getColumn(x).setCellEditor(CustomEditor())

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: 1808
    
    2
Override the table method getCellEditor(...). If the row is 0, return a default editor otherwise return super.getCellEditor()
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Verify input in jTable except for head row
 
Similar Threads
JTable editting
JTable
JTable
Restrict editable jTable cells except for top row
JTable(!!!)