• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this site Swing Examples
 
Meghna ks
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example 2 for tables on the link I gave you does the same.
 
Durga Penmatsa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic