test/javax/swing/JTableHeader/6884066/bug6884066.java

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25    @bug 6884066
  26    @summary JTableHeader listens mouse in disabled state and doesn't work when not attached to a table
  27    @author Alexander Potochkin
  28    @run main bug6884066
  29 */
  30 
  31 import javax.swing.*;
  32 import javax.swing.table.JTableHeader;
  33 import javax.swing.table.TableColumnModel;
  34 import javax.swing.table.TableColumn;
  35 import java.awt.*;
  36 import java.awt.event.InputEvent;
  37 
  38 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
  39 
  40 public class bug6884066 {
  41     private static JTableHeader header;
  42 
  43     public static void main(String[] args) throws Exception {
  44 
  45         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  46 
  47         Robot robot = new Robot();
  48         robot.setAutoDelay(20);
  49         SwingUtilities.invokeAndWait(new Runnable() {
  50             public void run() {
  51                 // just to quickly grab a column model
  52                 JTable table = new JTable(10, 5);
  53                 header = new JTableHeader(table.getColumnModel());
  54                 checkColumn(0, "A");
  55                 JFrame frame = new JFrame("standalone header");
  56                 frame.add(header);
  57                 frame.pack();
  58                 frame.setVisible(true);
  59                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25    @bug 6884066
  26    @summary JTableHeader listens mouse in disabled state and doesn't work when not attached to a table
  27    @author Alexander Potochkin
  28    @run main bug6884066
  29 */
  30 
  31 import javax.swing.*;
  32 import javax.swing.table.JTableHeader;
  33 import javax.swing.table.TableColumnModel;
  34 import javax.swing.table.TableColumn;
  35 import java.awt.*;
  36 import java.awt.event.InputEvent;
  37 


  38 public class bug6884066 {
  39     private static JTableHeader header;
  40 
  41     public static void main(String[] args) throws Exception {
  42 
  43         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  44 
  45         Robot robot = new Robot();
  46         robot.setAutoDelay(20);
  47         SwingUtilities.invokeAndWait(new Runnable() {
  48             public void run() {
  49                 // just to quickly grab a column model
  50                 JTable table = new JTable(10, 5);
  51                 header = new JTableHeader(table.getColumnModel());
  52                 checkColumn(0, "A");
  53                 JFrame frame = new JFrame("standalone header");
  54                 frame.add(header);
  55                 frame.pack();
  56                 frame.setVisible(true);
  57                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);