-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.2
-
x86
-
windows_2000
Name: rmT116609 Date: 08/19/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
I've created a mouse and key event recoreder and player, when I found that the following scenario does not work:
Having the awt.robot selecting text in a text field with shift+[any motion key] does not work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JTextField with "This is a test" in it.
Use the awt.Robot to got to the end, then:
- press shift
- press and release left
- press and release left
- press and release left
- press and release left
- release shift
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect the word "test" to be selected.
ACTUAL -
The cursor had moved, but there was no selection.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class QuickTest extends JFrame
{
public QuickTest()
{
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
});
JPanel bg = new JPanel();
this.setContentPane(bg);
JTextField textField = new JTextField("This is a test");
bg.add(textField);
this.setTitle("QuiclTest");
this.pack();
this.setVisible(true);
//textField.requestDefaultFocus();
Robot robot = null;
try
{
robot = new Robot();
}
catch (AWTException e)
{
e.printStackTrace();
}
robot.keyPress(KeyEvent.VK_END);
robot.keyRelease(KeyEvent.VK_END);
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_SHIFT);
}
public static void main(String[] args)
{
new QuickTest();
}
}
---------- END SOURCE ----------
(Incident Review ID: 199216)
======================================================================
- duplicates
-
JDK-4908075 Press shift and another key using robot does not trigger events properly - WinXP
-
- Resolved
-