I want to use two buttons with actionperformed in only one cell of jtable
Asked
Active
Viewed 48 times
1 Answers
0
The problem is that JTable
doesn’t support a button renderer or editor.
To do this on your own:
Create a class that is both a renderer and an editor. The result is the ButtonColumn
class. You store text (or an Icon) in the TableModel
(the same way you store data for any other column) and the ButtonColumn
will render the text (or the Icon) on a button. When you create the class you specify an Action that is to be invoked when the button is pressed. You also specify the column that is used to contain the button so that the renderer and editor can be automatically installed on the appropriate TableColumn
of the TableColumnModel
.
After adding buttons in to cell. You can easily add ActionListenr
to buttons.

Blasanka
- 21,001
- 12
- 102
- 104