Forums Register Login

JComboBox in JTable

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
Do you want ants? Because that's how you get ants. And a tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 960 times.
Similar Threads
JComboBox in the JTable Editor
JTable Cell
JTable
JTable
Problem in JTable Renderer and Editor
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:23:41.