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

JInternalFrame skips MouseEntered events sometimes

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • P4
    • Resolution: Unresolved
    • 6
    • None
    • client-libs

    Description

      Please run the provided test
      Notice that when mouse slowly enters either frames it becomes selected
      Move the mouse cursor from one frame *title bar* to another frame's *title bar*
      If you do it several times back and forth you noticed that frames are out of sync -
       the mouse is over one frame, but the other one is still selected
      You shold move the mouse quickly to reproduce it

      Expected behavour:
      If mouse is over the internal frame, it should be selected

      Current behavour:
      If you move the mouse quickly they become out of sync

      JDK 6.0

      import javax.swing.*;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;
      import java.beans.PropertyVetoException;

      public class JifProblem {
          public static void main(String[] args) throws Exception {
              final JFrame frame = new JFrame("JInternalFrame problem");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              
              JDesktopPane pane = new JDesktopPane();
              
              JInternalFrame f1 = getInternalFrame();
              f1.setBounds(15, 10, 300, 50);
              pane.add(f1);

              JInternalFrame f2 = getInternalFrame();
              f2.setBounds(330, 10, 300, 50);
              pane.add(f2);
              
              frame.add(pane);
              frame.setSize(650, 150);
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
          }

          static private JInternalFrame getInternalFrame() {
              final JInternalFrame frame = new JInternalFrame("First frame");

              frame.setResizable(true);
              frame.addMouseListener(new MouseAdapter() {
                  public void mouseEntered(MouseEvent e) {
                      try {
                          frame.setSelected(true);
                      } catch (PropertyVetoException e1) {
                          e1.printStackTrace();
                      }
                  }
              });
              frame.setVisible(true);
              return frame;
          }
      }

      Attachments

        Activity

          People

            mbronsonsunw Mike Bronson (Inactive)
            alexp Alexander Potochkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: