List of utility methods to do JTable Column Pack
void | packColumn(JTable table, int colIndex) Sets the preferred width of a column of a JTable specified by colIndex. DefaultTableColumnModel columnModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn column = columnModel.getColumn(colIndex); int width; TableCellRenderer renderer = column.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); Component component = renderer.getTableCellRendererComponent(table, column.getHeaderValue(), false, false, ... |
void | packColumn(JTable table, int colIndex) pack Column TableColumnModel colModel = table.getColumnModel(); TableColumn col = colModel.getColumn(colIndex); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); ... |
void | packColumn(JTable table, int vColIndex, int margin) Sets the preferred width of the visible column specified by vColIndex. DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); ... |
void | packColumn(JTable table, int vColIndex, int margin) Sets the preferred width of the visible column specified by vColIndex. TableColumnModel colModel = table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); ... |
void | packColumn(JTable table, int vColIndex, int margin) PackColumn sets the preferred width of the visible column specified by vColIndex. DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width; javax.swing.table.TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); java.awt.Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, ... |
void | packColumn(JTable table, int vColIndex, int margin) pack Column DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); ... |
void | packColumns(final JTable table, final int margin) pack Columns for (int index = 0; index < table.getColumnCount(); index++) { packColumn(table, index, margin); |
void | packColumns(JTable table) Adjusts the widths of columns to be just wide enough to show all of the column headers and the widest cells in the columns for (int columnIndex = 0; columnIndex < table.getColumnCount(); columnIndex++) { packColumn(table, columnIndex, 2); |
void | packColumns(JTable table, int margin) pack Columns for (int c = 0; c < table.getColumnCount(); c++) { packColumn(table, c, 2); |
void | packColumns(JTable table, int width) pack Columns int padding = 5; TableColumnModel columnModel = table.getColumnModel(); int[] widths = new int[columnModel.getColumnCount()]; for (int j = 0; j < table.getRowCount(); j++) { for (int i = 0; i < widths.length; i++) { TableCellRenderer renderer = table.getCellRenderer(j, i); Object value = table.getValueAt(j, i); Component component = renderer.getTableCellRendererComponent(table, value, true, true, j, i); ... |