src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
Print this page
*** 101,111 ****
return;
}
if (e.getClickCount() % 2 == 1 &&
SwingUtilities.isLeftMouseButton(e)) {
JTable table = header.getTable();
! RowSorter sorter;
if (table != null && (sorter = table.getRowSorter()) != null) {
int columnIndex = header.columnAtPoint(e.getPoint());
if (columnIndex != -1) {
columnIndex = table.convertColumnIndexToModel(
columnIndex);
--- 101,111 ----
return;
}
if (e.getClickCount() % 2 == 1 &&
SwingUtilities.isLeftMouseButton(e)) {
JTable table = header.getTable();
! RowSorter<?> sorter;
if (table != null && (sorter = table.getRowSorter()) != null) {
int columnIndex = header.columnAtPoint(e.getPoint());
if (columnIndex != -1) {
columnIndex = table.convertColumnIndexToModel(
columnIndex);
*** 770,782 ****
* Return the minimum size of the header. The minimum width is the sum
* of the minimum widths of each column (plus inter-cell spacing).
*/
public Dimension getMinimumSize(JComponent c) {
long width = 0;
! Enumeration enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = (TableColumn)enumeration.nextElement();
width = width + aColumn.getMinWidth();
}
return createHeaderSize(width);
}
--- 770,782 ----
* Return the minimum size of the header. The minimum width is the sum
* of the minimum widths of each column (plus inter-cell spacing).
*/
public Dimension getMinimumSize(JComponent c) {
long width = 0;
! Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMinWidth();
}
return createHeaderSize(width);
}
*** 786,798 ****
* by the header renderers. The preferred width is the sum of the
* preferred widths of each column (plus inter-cell spacing).
*/
public Dimension getPreferredSize(JComponent c) {
long width = 0;
! Enumeration enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = (TableColumn)enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
}
return createHeaderSize(width);
}
--- 786,798 ----
* by the header renderers. The preferred width is the sum of the
* preferred widths of each column (plus inter-cell spacing).
*/
public Dimension getPreferredSize(JComponent c) {
long width = 0;
! Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getPreferredWidth();
}
return createHeaderSize(width);
}
*** 800,812 ****
* Return the maximum size of the header. The maximum width is the sum
* of the maximum widths of each column (plus inter-cell spacing).
*/
public Dimension getMaximumSize(JComponent c) {
long width = 0;
! Enumeration enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = (TableColumn)enumeration.nextElement();
width = width + aColumn.getMaxWidth();
}
return createHeaderSize(width);
}
--- 800,812 ----
* Return the maximum size of the header. The maximum width is the sum
* of the maximum widths of each column (plus inter-cell spacing).
*/
public Dimension getMaximumSize(JComponent c) {
long width = 0;
! Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
while (enumeration.hasMoreElements()) {
! TableColumn aColumn = enumeration.nextElement();
width = width + aColumn.getMaxWidth();
}
return createHeaderSize(width);
}
*** 873,883 ****
}
String name = getName();
if (TOGGLE_SORT_ORDER == name) {
JTable table = th.getTable();
! RowSorter sorter = table == null ? null : table.getRowSorter();
if (sorter != null) {
int columnIndex = ui.getSelectedColumnIndex();
columnIndex = table.convertColumnIndexToModel(
columnIndex);
sorter.toggleSortOrder(columnIndex);
--- 873,883 ----
}
String name = getName();
if (TOGGLE_SORT_ORDER == name) {
JTable table = th.getTable();
! RowSorter<?> sorter = table == null ? null : table.getRowSorter();
if (sorter != null) {
int columnIndex = ui.getSelectedColumnIndex();
columnIndex = table.convertColumnIndexToModel(
columnIndex);
sorter.toggleSortOrder(columnIndex);