January 31, 2012

right alignment in jtable cell


Example for right alignment of jtable cells in java swing



java.awt.Font font = new java.awt.Font("Serif", Font.BOLD, 12);
JTable table = new JTable();
searchResult_tbl.setAutoCreateRowSorter(true);
DefaultTableCellRenderer tableCellRenderer = new DefaultTableCellRenderer();
tableCellRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
tableCellRenderer.setForeground(Color.BLACK);
tableCellRenderer.setFont(font);
table.getColumn("total").setCellRenderer(tableCellRenderer);
table.setGridColor(theme.getColorTableGrid());



Mastering the jtable see the tutorial

Eid Mubrak to all visitors

facebook page :  https://www.facebook.com

1 comment:

Your feedback may help others !!!

Facebook comments