-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: rlT66838 Date: 07/20/99
/*
Program to illustrate the control-arrow bug.
Typing control-right arrow key in a JTextComponent will skip
past words, but won't skip past the last word. It stops at
the beginning of the last word.
The Key assignment documents claim that the control-arrow key
bindings aren't implemented yet, but those documents are out
of date. (I've submitted this as a separate bug. The docs are
jdk1.2.2/docs/api/javax/swing/doc-files/Key-Metal.html and
jdk1.2.2/docs/api/javax/swing/doc-files/Key-Win32.html)
Except for the bug skipping past the last word, control-arrow
is properly implemented. (In fact, all the key bindings for
Text Components are implemented)
To reproduce, run this program. Click into either the field
or the area. Hold down the control key and type a right
arrow. It will advance to the beginning of the next word, as
it should. Continue typing control-right-arrow until the
caret won't move anymore. Instead of stopping at the end of
the last word, it will stop at the beginning of the last word.
*/
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.plaf.multi.*;
import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.*;
public class ControlArrowBug extends JFrame
{
public static void main(String[] args)
{
// try { UIManager.setLookAndFeel(new MetalLookAndFeel()); }
// catch (Exception err) { }
// try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
// catch (Exception err) { }
new ControlArrowBug();
}
ControlArrowBug()
{
super("Control-Arrow Bug");
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent evt) { System.exit(0); } } );
setBounds(20, 20, 400, 300);
JTextArea area = new JTextArea("This is also a test");
JTextField fld = new JTextField("This is a test");
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add(fld, "North");
cp.add(area, "Center");
show();
}
}
(Review ID: 88145)
======================================================================
- duplicates
-
JDK-4282237 JTextField keybindings: Shift+Ctrl+arrow keys works inaccurately
-
- Closed
-