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

REGRESSION: componentMoved is now getting called for some hidden components

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b49
    • Introduced In Version:
      6
    • Resolved In Build:
      b81
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REGRESSION :
      componentMoved is now getting called for some hidden components

      When components are moved we use componentMoved to find their new location on the screen so that the next time that component is initialized it will be where the user left it. Only problem is that in Mustang componentMoved gets called for some components even when they are not showing on the screen.

      Running the code below reproduces the problem I am seeing.

      REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
      import java.awt.event.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              JFrame parentWindow = new JFrame();
              JButton component = new JButton() {
              };
              parentWindow.add(component);
              new JOptionPane().createInternalFrame(component, "Test").addComponentListener(
                  new ComponentAdapter() {
                public void componentMoved(ComponentEvent e) {
                  e.getComponent().getLocationOnScreen();
                }
              });
            }
          });
        }
      }

      RELEASE LAST WORKED:
      5.0 Update 6

      RELEASE TEST FAILS:
      mustang-b70

      OBSERVED APPLICATION IMPACT:
      This might affect all applications that were checking getLocationOnScreen() from the componentMoved method.
      As a workaround we need to check component.isShowing() from the componentMoved method and then return with out doing anything if it is not showing.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dav Andrei Dmitriev (Inactive)
              Reporter:
              ttzhang Tao Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: