• Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBox in JTable  RSS feed

 
sandeep kumar jangra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi All... I want to make a table in which data will be added on runtime. what actually will be done is that I will select a node from a JTree and on clicking a button I want that this object is placed in JTable provided and also there should be a JComboBox in one column which can be edited to furthur add the data and on clicking another button I want all this information.
I have tried cell editor and cell renderers with no success and it is very urgent ..

can anybody help me out

Thanks in advance
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is quite difficult to answer without further information. Where exactly are you stuck? What data structures are you using to hold your objects (Collections, arrays, etc). What exactly have you tried?

Note that with JTable you don't actually add anything to the table itself - you alter the underlying data structure and then call one of the 'fire' methods such as fireTableDataChanged(). JTree is a bit different because you have to mess around with TreeNodes.

My suggestion would be to get the table adding (and removing?) working on its own; maybe adding an item each time you click a JButton. When that is done, you can think about setting up the JTree and making the two cooperate.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!