Forums Register Login

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

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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


+Pie Number of slices to send: Send
Try this site Swing Examples
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Example 2 for tables on the link I gave you does the same.
+Pie Number of slices to send: Send
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


He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1611 times.
Similar Threads
JTable
JTable
JTable and JRadioButtons
Jtable
Disabling a cell of the JTable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:39:22.