• 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

JComboBox in JTable

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic