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

Keyboard events get lost in nested JSplitPanes on Solaris

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • None

      ralph.kar@Eng 1998-07-30
      Run the sample code below on the very latest Swing code on Solaris. There is a JSplitPane with a nested JSplitPane on the right-hand side. Move the focus to one of the components within the nested JSplitPane and hit F8. You are now able to resize the divider with the cursor keys. Hit TAB or CTRL+TAB to get out of the resize mode. Move the focus to the JList on the left-hand side of the outer JSplitPane. Hit F8 again and use the cursor keys to move the divider. Only the first keypress will be executed. All other keypresses do not appear and the focus does not come back (even after hitting TAB). If the Swing window gets overlayed by another window and then brought to the front again the focus comes back.
      This does not happen on Win32.
      It is also not related to JList (I tried several different components).
      It is somehow related to the nesting of JSplitPane, because when I run the example without a nested JSplitPane everything works well.


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

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

                      String[] listdata = {"JList 1", "JList 2", "JList 3",
                                           "JList 4", "JList 5", "JList 6"};
                      JList list = new JList(listdata);

                      JSplitPane split1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                              true,
                              new JScrollPane(new JTextArea("Upper\nJTextArea")),
                              new JScrollPane(new JTextArea("Lower\nJTextArea")));
                      JSplitPane split2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                              true, new JScrollPane(list), split1);

                      JPanel panel = new JPanel(new GridLayout(1, 2));
                      panel.add(new JButton("JButton 1"));
                      panel.add(new JButton("JButton 2"));

                      this.getContentPane().add("Center", split2);
                      this.getContentPane().add("South", panel);

                      this.addWindowListener(new WindowAdapter() {
                              public void windowClosing(WindowEvent ev) {
                                      System.exit(0);
                              }
                      });
                      this.setSize(300, 300);
                      this.setVisible(true);
              }

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

            hgajewsksunw Hania Gajewska (Inactive)
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: