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

requestFocus() does not set the focus correctly on Solaris

    • sparc
    • solaris_2.6

      Run the test case below and notice that after the frame shows on the screen initially none of the buttons has the focus although it was requested by requestFocus() that the right button does. After using TAB at least once, the buttons start to accept focus. This works fine on Win32.


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

      public class TestApp extends JFrame
      {
              public TestApp() {
                      super("TestApp");

                      this.addWindowListener(new WindowAdapter() {
                              public void windowClosing(WindowEvent ev) {
                                      System.exit(0);
                              }
                      });

                      JButton but1 = new JButton("not focused");
                      JButton but2 = new JButton("focused");
                      this.getContentPane().add("West", but1);
                      this.getContentPane().add("East", but2);

                      this.pack();
                      this.setVisible(true);

                      but2.requestFocus();
              }

              static public void main(String args[]) {
                      new TestApp();
              }
      }

            son Oleg Sukhodolsky (Inactive)
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: