Hi all, i want to align the text centei JTable cells how can i perform that.
posted 14 years ago
To achieve what you are looking for, use cell renderer for your table. Use the interface TableCellRenderer. In the interface you have a method "getTableCellRendererComponent" method which has various parameters. This renderer extends JLabel. You have to pass your cell to this renderer and it will be converted to JLabel. Use the SwingConstants.setHorizontalAlignment(CENTER) to display your text at the center of the cell. Hope you are able to follow the flow. regards