Align « JTable « Java Swing Q&A





1. align right in JTable    coderanch.com

Here's a sample cell renderer that will right align the contents: public class RightCellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { // Get the default rendering for the cell Component c = super.getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column); // Default cell rendering is a JLabel, align that to the ...

2. Right Align in JTable    forums.oracle.com