-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2, 1.3.0
-
generic, x86
-
generic, windows_nt
Name: skT45625 Date: 04/07/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-001, native threads, symcjit)
The behavior of JTextField and where it positions the cursor is different
depending on whether the JTextField is on a JFrame or a JDialog.
Reproduction:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test extends JFrame
{
public Test()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(4, 1));
contentPane.add(new JLabel("Press tab - JTextField positions cursor at
start of text"));
JButton button = new JButton("Dialog");
contentPane.add(button);
addTextFields(contentPane);
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
TestDialog td = new TestDialog();
td.show();
}
});
}
class TestDialog extends JDialog
{
public TestDialog()
{
setTitle("JDialog");
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(4, 1));
contentPane.add(new JLabel("Press tab - JTextField positions cursor at
end of text"));
contentPane.add(new JButton("dummy"));
addTextFields(contentPane);
pack();
}
}
private void addTextFields(Container contentPane)
{
TextField text = new TextField("TextField");
contentPane.add(text);
JTextField jtext = new JTextField("JTextField");
contentPane.add(jtext);
}
public static void main(String[] args)
{
JFrame f = new Test();
f.setTitle("JFrame");
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
f.pack();
f.setVisible(true);
}
}
###@###.### 2000-04-07
Reproduced in 1.3.0rc3 & 1.4.0beta
(Review ID: 103403)
======================================================================
- duplicates
-
JDK-4343970 JTextArea scrolls to end of text when displayed via JButton/JMenuItem
-
- Closed
-
-
JDK-4226384 JTextField.setText() from EventDispatchThread ignores alignment?
-
- Closed
-