Ever wondered how to make a cell in a JTable to render a JComboBox? This example will guide you on that. The scope of this tutorial does not have to be limited to combobox, the same concept applies in rendering other components in a JTable.
Author: Thiagu
- Create a JTable with two columns as shown below.
- Create an inner class that implements TableCellRender as below
- Set the particular column's renderer as the renderer class that you have created
- Create a JComboBox variable with the necessary values and pass it as a parameter to the constructor of the DefaultCellEditor class
- WALLA....there’s your combobox, right where you want it...
Author: Thiagu
No comments:
Post a Comment