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

Dialog button dn't gain focus when parent(frame) is minimized & maximized

    XMLWordPrintable

Details

    • b04
    • 7
    • sparc
    • solaris_10

    Description

      I have frame with a button which invokes a dialog(modaless). when the dialog is visible , the dialog which has the button has the focus. I minimize the frame, the dialog also get minimized. When i click on the iconified frame on the taskbar or system tray. The frame & dialog visible ( normal state), Now i would expect that dialog button should have the focus, but the frame button is having the focus. This works fine in jdk1.4.2 , jdk1.5.0 , jdk 6.0 & it even works fine in jdk 7.0 till b03 , but fails from jdk7.0 b04 onwards. So this is a regression. It even works fine in 6u1.

      Step to reproduce:
      ------------------
      1) Run the below program.
      2) Click on the "ShowDialogButton" button in the frame( which is having the focus)you will see a dialog.
      3) Observe that dialog button is having the focus.
      5) Minimize the frame. Both frame & dialog will be minimized.
      5) Click on the frame (iconified) on the taskbar or systemtray.
      6) Frame & Dialog is visible. Observe that Frame button is having the focus. Actually dialog button should have the focus.

      import java.awt.*;
      public class TestFocus {
          private Frame frame=null;
          private Dialog dialog=null;
          private Button showDialogButton=null , dialogButton=null;
          TestFocus( ) {
              frame = new Frame();
              frame.setLayout(new java.awt.FlowLayout());
              showDialogButton = new Button("ShowDialogButton");
              showDialogButton.addActionListener(new java.awt.event.ActionListener(){
                  public void actionPerformed(java.awt.event.ActionEvent ae){
                      dialog = new Dialog(frame , "Test focus Owner",false);
                      dialog.setLayout(new java.awt.FlowLayout());
                      dialog.add(dialogButton = new Button("DialogButton"));
                      dialog.pack();
                      dialog.setLocation(200,200);
                      dialog.setVisible(true);
                  }
              });
              frame.add(showDialogButton);
              frame.pack();
              frame.setVisible(true);
          }
          public static void main(String []args){
              new TestFocus();
          }
      }

      Attachments

        Issue Links

          Activity

            People

              bagiras Oleg Pekhovskiy (Inactive)
              lpremkumsunw Lawrence Premkumar1 (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: