JDK-4369781 : unix: Unexpected JSplitPane behaviour after the component resizing
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2000-09-11
  • Updated: 2001-01-06
  • Resolved: 2001-01-06
Related Reports
Duplicate :  
Description

Name: iaR10016			Date: 09/11/2000



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

The following test example demonstrates unexpected JSplitPane component behaviour.
To reproduce the bug please do the following steps:

   Enter top JTextArea component and type some text.
   Move mouse outside the tested frame and continue to press any keys.
   The keyboard events are processed correctly.
   Then resize the tested frame and repeat these actions.
   When mouse cursor is outside the tested frame bounds,
   keyboard event are not processed now.

   Such effect also observed in the bottom panel - current
   focused componet is changed correctly by "Tab" key pressing only if the frame was
   not resized yet.

I use KDE graphics environment with "Click to focus" Window focus policy property
setting. (To set focus policy to "Click to focus" please run KDE Control Center, select
"Windows Behaviour" node, then select "Properties" node, then select "Click to focus" in
the "Focuses Policy" list).

------------------------- test.java ---------------------------------------------

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

public class test extends JFrame {
  public test() {
    super("JSplitPane test");
    JSplitPane splitPane = new JSplitPane( JSplitPane.VERTICAL_SPLIT, new JTextArea(), new ButtonDemo() );
    splitPane.setDividerLocation(200);
    splitPane.setPreferredSize(new Dimension(500, 300));
    getContentPane().add(splitPane, BorderLayout.CENTER);
   }

  public static void main(String[] args) {
    JFrame frame = new test();
    frame.pack();
    frame.setVisible(true);
   }
}

class ButtonDemo extends JPanel {
    public ButtonDemo() {
        JButton b1 = new JButton("Button 1");
        add(b1);
        JButton b2 = new JButton("Button 2");
        b2.setNextFocusableComponent(b1);
        add(b2);
    }
}

---------------------------------------------------------------------------------

Please note that this efect is present only for the JSplitPane component. For example,
the following code demonstrates correct events processing:

------------------------- test1.java --------------------------------------------

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

public class test1 extends JFrame {
  public test1() {
    super("JTextArea test");
    getContentPane().add(new JTextArea());
   }
  public static void main(String[] args) {
    JFrame frame = new test1();
    frame.setSize(new Dimension(500, 300));
    frame.setVisible(true);
   }
}

---------------------------------------------------------------------------------

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

Comments
EVALUATION This bug used to also be reproducible on Solaris with CDE. It no longer is -- it has been fixed with the merlin focus improvements (4290675) although you also need the fix for split pane focus (4374030) to see that it's been fixed. So far, I haven't had the chance to test this on Linux; when I do, I will close out this bug as a dup of 4290675. hania.gajewska@Eng 2001-01-04 Tested on Linux with KDE; bug is fixed. hania.gajewska@Eng 2001-01-05
04-01-2001