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

JInternalFrame fails resetting mouse cursor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.1
    • client-libs



      Name: skT88420 Date: 05/14/99


      Here is the program that encounters the problem.

      import com.sun.java.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class WatermarkDemo
      extends JFrame
      {
          public WatermarkDemo()
          {
              super("Watermark Demo");

              JDesktopPane desktop = new JDesktopPane();
              getContentPane().add(desktop);

              JInternalFrame jif = new JInternalFrame (
      "Watermark Demo", true, false, true, false);

              ImageIcon watermark = new ImageIcon("watermark.gif");
              ImageIcon picture = new ImageIcon("picture.jpg");

              JScrollPane scroller = new JScrollPane(
      new WatermarkCanvas(watermark, picture));

              JComponent c = (JComponent) jif.getContentPane() ;
      c.add(scroller);

              jif.setBounds(30,50,300,250);
              desktop.add(jif);

              WindowListener l = new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              };
              addWindowListener(l);
              setSize(440,340);
              setVisible(true);
          }

          public static void main(String[] args)
          {
              new WatermarkDemo();
          }
      }
      class WatermarkCanvas
      extends JLabel
      {
          protected ImageIcon m_picture;
          protected ImageIcon m_watermark;

          public WatermarkCanvas(ImageIcon watermark,
          ImageIcon picture)
          {
              m_watermark = watermark;
              m_picture = picture;

              // Call this inherited method to set this label's
              // icon. This also sets the preferred size correctly.
              setIcon(picture);
          }

      It's a sample program from Swing connection's Friend column.
      It puts a JPanel with an ImageIcon object onto a JScrollPane,
      which sits in an JInternalFrame. The top level window is a JFrame.
      When I ran the application, I moved the mouse pointer slowly
      into the InternalFrame onto the JViewport of JScrollPane. When
      it crossed the JInternalFrame's left border, the mouse icon changes,
      it then continued going into the JViewport area. The mouse pointer
      did not change back to the default setting, it kept the same icon
      as it was positioned on the left border. When the mouse came in
      from other directions, it worked ok I guess because other borders
      had scroll bars or title bar. Then I enlarged the JInternalFrame to
      make the scroll bars disappeared, the problem repeated from right
      and bottom sides. Only the top (with a title bar) was ok.
      I tried to reset the mouse cursor after it entered the JViewport
      area, it did not work.
      (Review ID: 63208)
      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: