-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6u14
-
x86
-
windows_vista
FULL PRODUCT VERSION :
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
not important
A DESCRIPTION OF THE PROBLEM :
subject says it all (or see code :-)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
/**
* JTableHeader must not react to mouseEvents if disabled.
* Specifically: columns must not be
* - resizable
* - draggable
* - sortable
*
* Note that the resizing cursor not showing.
*
* @author Jeanette Winzenburg
*/
public class TableHeaderDisabled {
private JComponent createContent() {
JTable table = new JTable(20, 5);
table.setAutoCreateRowSorter(true);
table.setEnabled(false);
table.getTableHeader().setEnabled(false);
JComponent content = new JScrollPane(table);
return content;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TableHeaderDisabled().createContent());
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
nothing except going drastic, like subclassing JTableHeader, remove all mouseListeners on disabling and re-add again on enabling.
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
not important
A DESCRIPTION OF THE PROBLEM :
subject says it all (or see code :-)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
/**
* JTableHeader must not react to mouseEvents if disabled.
* Specifically: columns must not be
* - resizable
* - draggable
* - sortable
*
* Note that the resizing cursor not showing.
*
* @author Jeanette Winzenburg
*/
public class TableHeaderDisabled {
private JComponent createContent() {
JTable table = new JTable(20, 5);
table.setAutoCreateRowSorter(true);
table.setEnabled(false);
table.getTableHeader().setEnabled(false);
JComponent content = new JScrollPane(table);
return content;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TableHeaderDisabled().createContent());
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
nothing except going drastic, like subclassing JTableHeader, remove all mouseListeners on disabling and re-add again on enabling.
- duplicates
-
JDK-6884066 JTableHeader listens mouse in disabled state and doesn't work when not attached to a table
- Closed