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

Component inside JSplitPane loses focus when clicking on "one touch" button

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • generic
    • generic



      Name: ks88420 Date: 08/30/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      When changing the location of a JSplitPane divider by dragging
      it with the mouse, a focused component inside the split pane
      keeps the keyboard focus -- this is a good thing.

      However, when changing the location of the divider by clicking on
      one of its "one touch" buttons, the focused component inside the
      split pane will LOSE the focus -- this is a bad thing (bug).
      I'm not sure why this happens (since 4202792 seems to be fixed).

      ---

      In the attached test case, there's a one touch expandable JSplitPane
      containing a JTextArea (left) and a JTree (right). After starting
      the program, the JTextArea has the keyboard focus.

      Try expanding the JTextArea to the full width by clicking
      on the right arrow button on the divider. The JTextArea
      will lose the focus and the user now has to manually restore
      it before he can continue typing anything into the text area.

      ---

      import java.awt.*;
      import javax.swing.*;

      public class MyTest extends JFrame {
        public MyTest() {
          super("MyTest");
          
          JSplitPane spltPn = new JSplitPane();
          spltPn.setOneTouchExpandable(true);
          spltPn.setLeftComponent(new JTextArea());
          spltPn.setRightComponent(new JTree());
          spltPn.setDividerLocation(290);
          
          setContentPane(spltPn);
          
          setSize(new Dimension(608, 384));
          setLocation((getToolkit().getScreenSize().width - getWidth()) / 2,
            ((getToolkit().getScreenSize().height) - getHeight()) / 2);
            
          show();
        }
        
        public static void main(String[] args) {
          new MyTest();
        }
      }
      (Review ID: 108794)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: