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

Setting the cursor to CROSSHAIR_CURSOR in a JFrame displays TEXT_CURSOR instead

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      JRE 1.4.2_05 build 1.4.2_05-b04
      JRE 1.4.1_07 build 1.4.1_07-b02


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP Professional
      Version 2002
      Service Pack 2
      version 5.1 (number 2600.xpsp2_sp2_rtm.040803-2158 : Service Pack 2)

      A DESCRIPTION OF THE PROBLEM :
      When asking for a crosshair cursor, I get the text cursor instead.

      If I change the cursor scheme using the Windows config panel, and then run my program again, I get the appropriate crosshair cursor. If I go back to my initial cursor scheme, I also get the appropriate crosshair cursor.

      But then, if I reboot my computer, the problem reappears (i.e. I get the TEXT_CURSOR instead of the CROSSHAIR_CURSOR).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just run the provided code, and put your mouse inside the JFrame.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I was expecting the window to display the crosshair cursor
      ACTUAL -
      The window displays the text cursor

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class Crosshair extends JFrame {

          public Crosshair(){
      Container cpane=this.getContentPane();
      JPanel p1=new JPanel();
      cpane.add(p1);
      p1.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
      WindowListener w0=new WindowAdapter(){
      public void windowClosing(WindowEvent e){System.exit(0);}
      };
      this.addWindowListener(w0);
      this.setSize(200,200);
      this.setVisible(true);
          }

          public static void main(String[] args){
      Crosshair t=new Crosshair();
          }

      }
      ---------- END SOURCE ----------
      ###@###.### 10/13/04 11:51 GMT

            osemenovsunw Oleg Semenov (Inactive)
            dmikhalksunw Denis Mikhalkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: