Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6290972

confused mouse cursor in JTableHeader after setCursor and moving mouse

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.5.0_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
      Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      setCursor changes the Pointer in a included JTableHeader to.
      I the user move the mouse pointer between header area and the lines between the columns something will be confused.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      * Start example
      * Position the mouse over "column a" area
      * Press the key enter (cross hair cursor is shown)
      * Move the mouse between "column a" area and "column b" area (resize cursor displays)
      * Press the key enter again.
      * move mouse to "column a" area


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      default cursor is shown
      ACTUAL -
      crosshair cursor is shown

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      public class TableHeaderTest extends JFrame {
        public static void main(String[] args) {
          new TableHeaderTest();
        }
        JButton btnStart = new JButton("Crosshair");
        JButton btnStop = new JButton("Default");
        public TableHeaderTest() {
          super("table header test");
          this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
            }
          });
          btnStart.setMnemonic('c');
          btnStart.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              TableHeaderTest.this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
              TableHeaderTest.this.getRootPane().setDefaultButton(btnStop);
            }
          });
          this.getContentPane().add(btnStart);
          getRootPane().setDefaultButton(btnStart);
          btnStop.setMnemonic('d');
          btnStop.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              TableHeaderTest.this.setCursor(Cursor.getDefaultCursor());
              TableHeaderTest.this.getRootPane().setDefaultButton(btnStart);
            }
          });
          this.getContentPane().add(btnStop);
          JTable table = new JTable(new String[][] {{"1","2"},{"3","4"}},
                                    new String[] {"column a","column b"});
          table.getTableHeader().setPreferredSize(new Dimension(-1, 40));
          JScrollPane scrollPane = new JScrollPane(table);
          scrollPane.setPreferredSize(new Dimension(180, 80));
          this.getContentPane().add(scrollPane);
          this.getContentPane().setLayout(new FlowLayout());
          this.setSize(new Dimension(200, 150));
          this.setLocationRelativeTo(null);
          this.setVisible(true);
        }
      }

      ---------- END SOURCE ----------
      ###@###.### 2005-06-27 11:12:33 GMT

            osemenovsunw Oleg Semenov (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: