Reputation: 21
I have a Swing based application containing a JTable
. Now I would like to allow each row to be updated or deleted, using a unique row ID. So I want to add an update and delete button to each row, which have the capability to support an ActionListener. However, I have no idea how to do this using NetBeans.
Upvotes: 1
Views: 1708
Reputation: 324098
To display a button in a column you need to create:
Read the section from the Swing tutorial on How to Use Tables. The section on:
Using Custom Renders
will explain the basics of using a rendererUsing Other Editors
will explain the basics of using an editorWorking example are provided in the tutorial that you can download.
You can check out Table Button Column for one approach.
The code uses a single class to implement the custom renderer and editor that you will need for the column to display your text as a button.
Upvotes: 2