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

Setting cursor to not-default does not work in Dialog

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_1

      Description

      Here is the test case:
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;


      public class ActionLabel extends JLabel implements MouseListener{
          private Color originalColor;
          private Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
          private Cursor originalCursor = null;

          ActionLabel(String text, Color c){
            super(text);
            setForeground(c);
            addMouseListener(this);
            originalColor = c;
      System.out.println("getCursor="+getCursor());
      setCursor(handCursor);System.out.println("getCursor="+getCursor());
          }

          public void mouseClicked(MouseEvent e) {
            // Do something when user clicks on label...
          }

          public void mouseEntered(MouseEvent e) {
             setForeground(Color.RED);
          }

          public void mouseExited(MouseEvent e) {
              if(originalColor != null)
      setForeground(originalColor);
          }

          public void mousePressed(MouseEvent e) {
          }
          public void mouseReleased(MouseEvent e) {
          }


       public static void main(String [] args){
          JDialog test = new JDialog();
          ActionLabel details = new ActionLabel("Details...", Color.blue);
          test.getContentPane().add(details);
          test.pack();
          test.setVisible(true);
        }
      }


      In println I get the HAND_CURSOR, but on screen, the cursor does not change to HAND_CURSOR. Works with JRE 1.4.2_01. I did not try it with 1.5.0. Also works fine with JFrame instead of JDialog in 1.6.0.
      ###@###.### 2005-04-12 18:35:33 GMT

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              osemenovsunw Oleg Semenov (Inactive)
              Reporter:
              mafishersunw Margarita Fisher (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: