Reputation: 463
the problem i am facing is the following. I am doing a little Java project and i need to display a JTable of Strings with the last column being a JButton. I read the existing solutions but none suit my needs. The thing is that i already got my JButton with a preassigned controller and everything, so i don't want to add other classes or anything.
What i want is my JButton, who is already correctly prepared, to be display in the JTable. If that is not possible I would like to know if there is a way to display a JButton not in a JTable cell but next to the last cell of every row. Thank you for your help.
Upvotes: 0
Views: 95
Reputation: 35106
It's not really possible... It would require... I don't even know. I don't think its possible
The problem is that Swing components (like JTable) don't actually contain other components. They use a Renderer to render the graphics of the table, but there's no plumbing for events like button clicks.
You'd be better off using a regular JPanel with a GridLayout or a GridBagLayout if you need this functionality
Upvotes: 1