@Test public void testGetColumnWidths() { int[] origWidths = table.getColumnWidths(); TableColumn col0 = table.getTable().getColumnModel().getColumn(0); col0.setPreferredWidth(origWidths[0] * 2); int[] newWidths = table.getColumnWidths(); for (int i=0; i<table.getTable().getColumnCount(); ++i) { if (i == 0) { assertEquals(newWidths[i], origWidths[i] * 2); } else { assertEquals(newWidths[i], origWidths[i]); } } table.setColumnWidths(origWidths); TestUtil.assertArraysEqual(table.getColumnWidths(), origWidths); }
public int[] getColumnWidths() { int[] widths = new int[table.getColumnCount()]; for (int i=0; i<widths.length; ++i) { TableColumn col = table.getColumnModel().getColumn(i); widths[i] = col.getPreferredWidth(); } return widths; }
LabeledTable extends JPanel { public int[] getColumnWidths() { int[] widths = new int[table.getColumnCount()]; for (int i=0; i<widths.length; ++i) { TableColumn col = table.getColumnModel().getColumn(i); widths[i] = col.getPreferredWidth(); } return widths; } }
LabeledTable extends JPanel { public int[] getColumnWidths() { int[] widths = new int[table.getColumnCount()]; for (int i=0; i<widths.length; ++i) { TableColumn col = table.getColumnModel().getColumn(i); widths[i] = col.getPreferredWidth(); } return widths; } LabeledTable(final LabeledTableModel model); }
LabeledTable extends JPanel { public int[] getColumnWidths() { int[] widths = new int[table.getColumnCount()]; for (int i=0; i<widths.length; ++i) { TableColumn col = table.getColumnModel().getColumn(i); widths[i] = col.getPreferredWidth(); } return widths; } LabeledTable(final LabeledTableModel model); void updateColumnsFromModel(int[] columnWidths); void updateColumnsHeaderValuesOnly(); void setRestoringSettings(boolean flag); void addTableLayoutListener(TableLayoutListener l); void removeTableLayoutListener(TableLayoutListener l); void addTableSelectionListener(TableSelectionListener l); void removeTableSelectionListener(TableSelectionListener l); int[] getSelectedRows(); int[] getSelectedColumns(); int[] getColumnWidths(); void setColumnWidths(int[] widths); void setColumnWidths(int[] columnIndices, int width); int[] getColumnOrder(); void setColumnOrder(int[] order); Integer[] getRowHeights(); Integer getRowHeight(int rowIndex); void setRowHeights(int[] heights); void setRowHeights(int[] rowIndices, int height); void setRowHeight(int rowIndex, int height); void setRowHeaderAlignments(ContentAlignment[] alignments); void setRowHeaderAlignment(int rowIndex, ContentAlignment newAlignment); void setRowHeaderBorderStates(BorderState[] borderStates); void setRowHeaderBorderState(int rowIndex, BorderState newBorderState); JVMFontFamily[] getRowHeaderFontNames(); JVMFontFamily getRowHeaderFontName(int rowIndex); void setRowHeaderFontNames(JVMFontFamily[] fontNames); void setRowHeaderFontName(int rowIndex, JVMFontFamily fontName); void setRowHeaderFontColors(Color[] fontColors); void setRowHeaderFontColor(int rowIndex, Color fontColor); void setRowHeaderBorderColors(Color[] borderColors); void setRowHeaderBorderColor(int rowIndex, Color borderColor); void setRowHeaderBackgroundColors(Color[] bgColors); void setRowHeaderBackgroundColor(int rowIndex, Color bgColor); void setRowHeaderFontStyles(Integer[] fontStyles); void setRowHeaderFontStyle(int rowIndex, Integer fontStyle); void setRowHeaderTextAttributes(Integer[] attributes); void setRowHeaderTextAttribute(int rowIndex, Integer attribute); void setRowHeaderFontSizes(Integer[] fontSizes); void setRowHeaderFontSize(int rowIndex, Integer fontSize); void setColumnHeaderFontStyles(Integer[] fontStyles); void setColumnHeaderFontStyle(int columnIndex, Integer fontStyle); void setColumnHeaderFontSizes(Integer[] fontSizes); void setColumnHeaderFontSize(int columnIndex, Integer fontSize); JVMFontFamily[] getColumnHeaderFontNames(); JVMFontFamily getColumnHeaderFontName(int colIndex); void setColumnHeaderFontNames(JVMFontFamily[] fontNames); void setColumnHeaderFontName(int columnIndex, JVMFontFamily fontName); void setColumnHeaderFontColors(Color[] fontColors); void setColumnHeaderFontColor(int columnIndex, Color fontColor); void setColumnHeaderBorderColors(Color[] borderColors); void setColumnHeaderBorderColor(int columnIndex, Color borderColor); void setColumnHeaderBackgroundColors(Color[] bgColors); void setColumnHeaderBackgroundColor(int columnIndex, Color bgColor); void setColumnHeaderTextAttributes(Integer[] attributes); void setColumnHeaderTextAttribute(int colIndex, Integer attribute); ContentAlignment[] getRowHeaderAlignments(); ContentAlignment getRowHeaderAlignment(int rowIndex); BorderState[] getRowHeaderBorderStates(); BorderState getRowHeaderBorderState(int rowIndex); Integer[] getRowHeaderFontStyles(); Integer getRowHeaderFontStyle(int rowIndex); Integer[] getRowHeaderTextAttributes(); Integer getRowHeaderTextAttribute(int rowIndex); Integer[] getColumnHeaderTextAttributes(); Integer getColumnHeaderTextAttribute(int colIndex); Color[] getRowHeaderFontColors(); Color getRowHeaderFontColor(int rowIndex); Color[] getRowHeaderBorderColors(); Color getRowHeaderBorderColor(int rowIndex); Color[] getRowHeaderBackgroundColors(); Color getRowHeaderBackgroundColor(int rowIndex); Integer[] getRowHeaderFontSizes(); Integer getRowHeaderFontSize(int rowIndex); Integer[] getColumnHeaderFontStyles(); Integer getColumnHeaderFontStyle(int colIndex); Integer[] getColumnHeaderFontSizes(); Integer getColumnHeaderFontSize(int colIndex); Color[] getColumnHeaderFontColors(); Color getColumnHeaderFontColor(int colIndex); Color[] getColumnHeaderBorderColors(); Color getColumnHeaderBorderColor(int colIndex); Color[] getColumnHeaderBackgroundColors(); Color getColumnHeaderBackgroundColor(int colIndex); void setColumnHeaderAlignments(ContentAlignment[] alignments); void setColumnHeaderAlignment(int columnIndex, ContentAlignment newAlignment); void setColumnHeaderBorderStates(BorderState[] borderStates); void setColumnHeaderBorderState(int colIndex, BorderState newBorderState); ContentAlignment[] getColummnHeaderAlignments(); ContentAlignment getColumnHeaderAlignment(int columnIndex); BorderState[] getColumnHeaderBorderStates(); BorderState getColumnHeaderBorderState(int colIndex); boolean getShowGrid(); void setShowGrid(boolean showGrid); JTable getTable(); JList getRowHeaders(); boolean isRowHeadersVisible(); boolean isColumnHeadersVisible(); void setRowHeadersVisible(boolean isVisible); void setColumnHeadersVisible(boolean isVisible); void setTitleVisible(boolean visible); void updateDropMode(); void setHeaderBorder(Border border); }
LabeledTable extends JPanel { public int[] getColumnWidths() { int[] widths = new int[table.getColumnCount()]; for (int i=0; i<widths.length; ++i) { TableColumn col = table.getColumnModel().getColumn(i); widths[i] = col.getPreferredWidth(); } return widths; } LabeledTable(final LabeledTableModel model); void updateColumnsFromModel(int[] columnWidths); void updateColumnsHeaderValuesOnly(); void setRestoringSettings(boolean flag); void addTableLayoutListener(TableLayoutListener l); void removeTableLayoutListener(TableLayoutListener l); void addTableSelectionListener(TableSelectionListener l); void removeTableSelectionListener(TableSelectionListener l); int[] getSelectedRows(); int[] getSelectedColumns(); int[] getColumnWidths(); void setColumnWidths(int[] widths); void setColumnWidths(int[] columnIndices, int width); int[] getColumnOrder(); void setColumnOrder(int[] order); Integer[] getRowHeights(); Integer getRowHeight(int rowIndex); void setRowHeights(int[] heights); void setRowHeights(int[] rowIndices, int height); void setRowHeight(int rowIndex, int height); void setRowHeaderAlignments(ContentAlignment[] alignments); void setRowHeaderAlignment(int rowIndex, ContentAlignment newAlignment); void setRowHeaderBorderStates(BorderState[] borderStates); void setRowHeaderBorderState(int rowIndex, BorderState newBorderState); JVMFontFamily[] getRowHeaderFontNames(); JVMFontFamily getRowHeaderFontName(int rowIndex); void setRowHeaderFontNames(JVMFontFamily[] fontNames); void setRowHeaderFontName(int rowIndex, JVMFontFamily fontName); void setRowHeaderFontColors(Color[] fontColors); void setRowHeaderFontColor(int rowIndex, Color fontColor); void setRowHeaderBorderColors(Color[] borderColors); void setRowHeaderBorderColor(int rowIndex, Color borderColor); void setRowHeaderBackgroundColors(Color[] bgColors); void setRowHeaderBackgroundColor(int rowIndex, Color bgColor); void setRowHeaderFontStyles(Integer[] fontStyles); void setRowHeaderFontStyle(int rowIndex, Integer fontStyle); void setRowHeaderTextAttributes(Integer[] attributes); void setRowHeaderTextAttribute(int rowIndex, Integer attribute); void setRowHeaderFontSizes(Integer[] fontSizes); void setRowHeaderFontSize(int rowIndex, Integer fontSize); void setColumnHeaderFontStyles(Integer[] fontStyles); void setColumnHeaderFontStyle(int columnIndex, Integer fontStyle); void setColumnHeaderFontSizes(Integer[] fontSizes); void setColumnHeaderFontSize(int columnIndex, Integer fontSize); JVMFontFamily[] getColumnHeaderFontNames(); JVMFontFamily getColumnHeaderFontName(int colIndex); void setColumnHeaderFontNames(JVMFontFamily[] fontNames); void setColumnHeaderFontName(int columnIndex, JVMFontFamily fontName); void setColumnHeaderFontColors(Color[] fontColors); void setColumnHeaderFontColor(int columnIndex, Color fontColor); void setColumnHeaderBorderColors(Color[] borderColors); void setColumnHeaderBorderColor(int columnIndex, Color borderColor); void setColumnHeaderBackgroundColors(Color[] bgColors); void setColumnHeaderBackgroundColor(int columnIndex, Color bgColor); void setColumnHeaderTextAttributes(Integer[] attributes); void setColumnHeaderTextAttribute(int colIndex, Integer attribute); ContentAlignment[] getRowHeaderAlignments(); ContentAlignment getRowHeaderAlignment(int rowIndex); BorderState[] getRowHeaderBorderStates(); BorderState getRowHeaderBorderState(int rowIndex); Integer[] getRowHeaderFontStyles(); Integer getRowHeaderFontStyle(int rowIndex); Integer[] getRowHeaderTextAttributes(); Integer getRowHeaderTextAttribute(int rowIndex); Integer[] getColumnHeaderTextAttributes(); Integer getColumnHeaderTextAttribute(int colIndex); Color[] getRowHeaderFontColors(); Color getRowHeaderFontColor(int rowIndex); Color[] getRowHeaderBorderColors(); Color getRowHeaderBorderColor(int rowIndex); Color[] getRowHeaderBackgroundColors(); Color getRowHeaderBackgroundColor(int rowIndex); Integer[] getRowHeaderFontSizes(); Integer getRowHeaderFontSize(int rowIndex); Integer[] getColumnHeaderFontStyles(); Integer getColumnHeaderFontStyle(int colIndex); Integer[] getColumnHeaderFontSizes(); Integer getColumnHeaderFontSize(int colIndex); Color[] getColumnHeaderFontColors(); Color getColumnHeaderFontColor(int colIndex); Color[] getColumnHeaderBorderColors(); Color getColumnHeaderBorderColor(int colIndex); Color[] getColumnHeaderBackgroundColors(); Color getColumnHeaderBackgroundColor(int colIndex); void setColumnHeaderAlignments(ContentAlignment[] alignments); void setColumnHeaderAlignment(int columnIndex, ContentAlignment newAlignment); void setColumnHeaderBorderStates(BorderState[] borderStates); void setColumnHeaderBorderState(int colIndex, BorderState newBorderState); ContentAlignment[] getColummnHeaderAlignments(); ContentAlignment getColumnHeaderAlignment(int columnIndex); BorderState[] getColumnHeaderBorderStates(); BorderState getColumnHeaderBorderState(int colIndex); boolean getShowGrid(); void setShowGrid(boolean showGrid); JTable getTable(); JList getRowHeaders(); boolean isRowHeadersVisible(); boolean isColumnHeadersVisible(); void setRowHeadersVisible(boolean isVisible); void setColumnHeadersVisible(boolean isVisible); void setTitleVisible(boolean visible); void updateDropMode(); void setHeaderBorder(Border border);  }