• 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

Jtable cells

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
How can I get every cell within my JTable to have the two combo boxes that are in the code below to display what currently dispaly.
Thanks
Ben
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nathan Pruett:
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?



I have the TableCellRenderer class but how would I do the suggested above.
Also I do want to coulmns the first column would get the Table names from the DataBase the second column gets the colum names from that table the user selected in the column.
Coould you helo me construct my code for the table cell renderer?
what I have at the moment
 
reply
    Bookmark Topic Watch Topic
  • New Topic