• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

JTable Spread Sheet

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am developed an application finally, i have to show the result into a form of spread sheet, i used JTable(in this i used component like Check box and combo box) but i stuck here if i want to add JList into JTable. I want to show the result in this form using JTable can any one please help me out ..

ID NO Vendor Group Users
1 abc 1 a
b
3 e
g
h

2 xyz 2 b
c
d

3 def 3 a


what i would like i want to add Jlist for column name Group and User. Can anyone please give me some good suggestion. Or any thing that maintain that state of showing data without using Jlist...

Thanks in advance
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand correctly, a JComboBox might be a better bet for this data. Either way, you will want to use a custom CellEditor. There is a nice section on this in the Java Tutorial under the heading "Using a Combo Box as an Editor":

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
 
ghazanfar khan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, actually whta i want to place JList into JTable cell. for Group and Users cell

ID NO Vendor Group Users
1 abc 1 a
b
3 e
g
h

2 xyz 2 b
c
d

3 def 3 a
 
Ranch Hand
Posts: 2373
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What IDE do you use for developing JTable codes? Although my general purpose IDE is Eclipse, I use NetBeans for Swing components development.

-- Ashik
Atlanta, USA
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well even if you don't want to use a combo box, you still need to create your own CellEditor because you will be using a JList to edit the values of the cells (instead of one of the standard editors). You might also need to create your own CellRenderer...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!