-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
sparc
-
solaris_8
Name: nt126004 Date: 09/12/2001
java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)
Once DefaultFocusManager.getCurrentManager() or
DefaultFocusManager.setCurrentManager() are executed, tabbing stops working in
a UNIX environment. Shift-TAB still works. When getCurrentKeyboardFocusManager
() is used instead, tabbing works correctly.
This is a problem for us since it impacts compatibility between 1.3 & 1.4. We
would like to know if this can be fixed by the production release, or if you
have suggestions on an easy work around.
Example code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.lang.reflect.*;
public class Test2 extends JFrame implements ActionListener {
private JButton btnQuit = new JButton("Quit");
private JLabel lblEnterStudy = new JLabel("Study: ");
private JTextField txtStudy = new JTextField(10);
private JLabel lblEnterSubj = new JLabel("Subject: ");
private JTextField txtSubj = new JTextField(10);
public Test2() {
super("Test");
setBounds( 300,100,500,600);
FocusManager fm = DefaultFocusManager.getCurrentManager();
// this however works:
// KeyboardFocusManager fm =
// DefaultFocusManager.getCurrentKeyboardFocusManager();
createTopDisplay();
// Upon a close, we should do nothing by default: this allows for a user
// to return to his/her editing session if he/she accidentally hit the
"close"
// button before saving changes made to data.
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
pack();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Dimension d = getToolkit().getScreenSize();
setSize(500, 100);
setLocation((int)(d.getWidth()/2 - getWidth()/2), (int)(d.getHeight()/2-
getHeight()/2));
setVisible(true);
}
private void createTopDisplay() {
Container Win = getContentPane();
JPanel top = new JPanel(new FlowLayout(FlowLayout.LEFT));
Box topBox = new Box(BoxLayout.Y_AXIS);
topBox.add(top);
top.add(lblEnterStudy);
txtStudy.addActionListener(this);
top.add(txtStudy);
top.add(Box.createHorizontalStrut(10));
top.add(lblEnterSubj);
txtSubj.addActionListener(this);
top.add(txtSubj);
top.add(btnQuit);
btnQuit.addActionListener(this);
Win.add(topBox, BorderLayout.NORTH);
}
public static void main(String[] x) {
new Test2();
}
public void actionPerformed(ActionEvent e) {
Object c = e.getSource();
if (c == btnQuit) {
System.out.println("actionPerformed() btnQuit pressed");
System.exit(0);
} else if (c==txtStudy || c==txtSubj) {
System.out.println("actionPerformed() on text component");
}
}
}
(Review ID: 131576)
======================================================================