It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes Rendering a single column in a JTable for accepting different datatypes ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Rendering a single column in a JTable for accepting different datatypes ?" Watch "Rendering a single column in a JTable for accepting different datatypes ?" New topic
Author

Rendering a single column in a JTable for accepting different datatypes ?

Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi
I need to make the 2nd column in a JTable to accept different data types eg; Integer, Float, String, Color, File, Font(cell rendered as a textfield with a borderlayout & a button within the textfield's east layout with a dialog box popping up when the button is clicked). How can a single column of a JTable be taken care of all these requirements?
Thanks
Meghna
Durga Penmatsa
Greenhorn

Joined: Aug 14, 2001
Posts: 23
Hi,
I dont think so it would be possible for a column to accept
the said data types. The entire column can have only one datatype. I would be pleased to know if it is possible to do so.
Regards
Durga

Originally posted by Meghna ks:
Hi
I need to make the 2nd column in a JTable to accept different data types eg; Integer, Float, String, Color, File, Font(cell rendered as a textfield with a borderlayout & a button within the textfield's east layout with a dialog box popping up when the button is clicked). How can a single column of a JTable be taken care of all these requirements?
Thanks
Meghna

Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Try this site Swing Examples
Meghna ks
Ranch Hand

Joined: Mar 15, 2001
Posts: 122
Hi Paul & Durga
Thanks for the immediate response. Paul -> I did go thro' the link you mailed me, but could'nt come up with something that suits my requirement. But, this link offers an example, I'm trying to build on this example. Wish me luck !!
http://www.javaworld.com/javaworld/javatips/jw-javatip102.html
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Example 2 for tables on the link I gave you does the same.
Durga Penmatsa
Greenhorn

Joined: Aug 14, 2001
Posts: 23
Hi Meghna,
Thanks for making me aware of the link. I had gone thru the link, the RowEditorModel basically sets the editor for the entire row, which is what we don't want. We want to set the editor at a cell level not yet row level. You may have to change this RowEditorModel to CellEditorModel. The CellEditorModel should return me a editor if I call getEditor(int row, int col).
Please let me know how you could do it.
Regards
Durga
Originally posted by Meghna ks:
Hi Paul & Durga
Thanks for the immediate response. Paul -> I did go thro' the link you mailed me, but could'nt come up with something that suits my requirement. But, this link offers an example, I'm trying to build on this example. Wish me luck !!
http://www.javaworld.com/javaworld/javatips/jw-javatip102.html

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rendering a single column in a JTable for accepting different datatypes ?
 
Similar Threads
JTable and JRadioButtons
JTable
Disabling a cell of the JTable
Jtable
JTable