-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
rc1
-
sparc
-
solaris_8, solaris_9
-
Verified
Platforms : Solaris Sparc , Linux Red Hat 7.1
java version used :
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b81)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b81, mixed mode)
Focus Traversal does not happen in the order in which the components are
added to the Frame . Attached is a test program which adds components to
a frame in the following order .
1) Button
2) TextField
3) List
4) Choice .
When this program is run, the initial focus will be on the Button . Press "Tab" key till the focus is on the List. At this point when you press "Tab" key the focus should be on the Choice ,whereas in JDK build 81 the focus goes to the
Button . When you keep pressing TAB , at one point you will observe that the focus starts going backwards when it is expected to traverse forward .
(I am not using any User defined Focus Traversal policy )
The same problem happens in Backward Traversal when you press"Shift+ Tab" .
This problem is only seen on Solaris and Linux platforms . Focus Traversal works fine on Windows
Note : This is happening in Build 81 and is not reproducable
on Build 80 .
Test Program :
========================================================================
import java.awt.*;
import java.awt.event.*;
public class FocusTest extends Frame implements MouseListener,ActionListener,
KeyListener {
Frame frame;
Button button;
TextField textField;
java.awt.List list;
Choice choice;
public FocusTest() {
frame=new Frame();
frame.setTitle("Focus Test");
frame.setLayout(new FlowLayout());
button=new Button("BUTTON");
textField=new TextField(5);
list = new java.awt.List(3);
choice =new Choice();
choice.add("choice1");
choice.add("choice2");
choice.add("choice3");
list.add("one");
list.add("two");
list.add("three");
button.addMouseListener(this);
button.addKeyListener(this);
button.addActionListener(this);
textField.addMouseListener(this);
textField.addKeyListener(this);
textField.addActionListener(this);
list.addMouseListener(this);
list.addKeyListener(this);
choice.addMouseListener(this);
choice.addKeyListener(this);
frame.add(button);
frame.add(textField);
frame.add(list);
frame.add(choice);
frame.setBackground(Color.red);
frame.setSize(500,200);
frame.setVisible(true);
frame.toFront();
}
public void actionPerformed(ActionEvent ae) {
System.out.println("in action performed method");
}
public void keyPressed(KeyEvent e) {
System.out.println("Key Pressed ");
}
public void keyReleased(KeyEvent ke) {
System.out.println("keyReleased called ");
}
public void keyTyped(KeyEvent ke) {
System.out.println("keyTyped called ");
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
System.out.println("mouseReleased called on");
}
public void mouseEntered(MouseEvent e) {
System.out.println("mouseEntered called :");
}
public void mouseExited(MouseEvent e) {
System.out.println("mouseExited called ");
}
public void mouseClicked(MouseEvent e) {
System.out.println("mouseClicked called ");
}
public static void main(String args[]){
new FocusTest();
}
}
========================================================================
- duplicates
-
JDK-4512845 SOLARIS:List component having problems in Focus Traversal
-
- Closed
-