-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_xp
Name: gm110360 Date: 09/03/2002
FULL PRODUCT VERSION :
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
There is a JScrollPane which contains focused component,
and JScrollPane has visible scroller. This JScrollPane was
removed from its parent. Focus was moved to the scroller
of the removed JScrollPane. Furthermore, requestFocus() on
one of the remaining siblings of the removed JScrollPane
does not help unless it is done via invokeLater.
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Launch attached test program.
2. Click to the upper text area.
3. Type in any key. The upper text area will be removed
(as desired), but focus stays in the removed component
(see console output).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
public class ScrollPaneFocusBugTest {
private static class MyComponent {
protected JComponent myComponent;
public MyComponent(final JComponent toFocus){
final JTextArea textArea = new JTextArea("1111\n2222\n3333\n4444\n5555
\n");
myComponent = new JScrollPane(textArea);
textArea.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e){
Container parent = myComponent.getParent();
parent.remove(myComponent);
parent.validate();
parent.repaint();
toFocus.requestFocus();
}
});
}
public JComponent getComponent(){
return myComponent;
}
}
public static void main(String[] args){
JFrame frame = new JFrame();
frame.getContentPane().setLayout(new BorderLayout());
JTextField textField = new JTextField("second");
frame.getContentPane().add(textField, BorderLayout.SOUTH);
JComponent component = new MyComponent(textField).getComponent();
component.setPreferredSize(new Dimension(40, 40));
frame.getContentPane().add(component, BorderLayout.CENTER);
frame.pack();
frame.show();
KeyboardFocusManager.getCurrentKeyboardFocusManager
().addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt){
Component component = (Component)evt.getNewValue();
System.out.println("component = " + component);
}
});
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.0_01
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 163925)
======================================================================
- duplicates
-
JDK-4722671 Accessibility problem in JRE Finder
- Resolved