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

Problems when requesting focus on component and hiding it at once

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs
    • generic
    • generic

      Name: dmR10075 Date: 08/15/2002



      Here is the test case:
      import java.awt.*;
      import javax.swing.*;

      public class Test extends JFrame {
          public static void main(String[] args) {
              new Test();
          }
          public Test() {
              super("Test for mnemonics");
              getContentPane().setLayout(new FlowLayout());
              JButton b = new JButton("press");
              getContentPane().add(b);
              b = new JButton("press 2");
              getContentPane().add(b);
              pack();
              setVisible(true);
              try {
                  Thread.sleep(1000);
              } catch (Exception e) {
              }
              b.requestFocus();
              getContentPane().remove(b);
          }
      }

      Compile it and run. You will see that frame has one button and no
      visible focus owner. But in fact there is a focus owner - it is
      component which is not currently in a frame, it has isShowing() ==
      false. In this case, with 1.4.1, mnemonics doesn't work.

      >From documentation it is not stated that the program above does
      anything wrong but we see two problems - mnemonics doesn't work and
      focus owner is actually not isShowing() - and these problems should be
      solved.


      ======================================================================

            son Oleg Sukhodolsky (Inactive)
            domsunw Dom Dom (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: