so, i'm i writting a program in java, and i need to similate the 'ת' key pressing, i changing the keyboard input language to hebrew and when i trying to simulate the 'ת' key pressing the written character is ',' (sometimes), why? and how i fixing it to write the 'ת' character?
The code snippet:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Test extends JFrame{
private static Robot robot;
public static void main(String[] args) {
try {
robot = new Robot();
} catch (AWTException e1) {
e1.printStackTrace();
}
JFrame win = new JFrame();
win.setSize(200,100);
JPanel panel = new JPanel();
JButton button = new JButton("simulate");
final JTextField textField = new JTextField();
textField.setPreferredSize(new Dimension(100, 30));
panel.add(textField);
panel.add(button);
win.add(panel);
win.setVisible(true);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
textField.requestFocus();
robot.keyPress(0X2C);
robot.keyRelease(0X2C);
}
});
}
}
I have tried also to simulate the key code: KeyEvent.COMMA
(also, dosen't work like i need..)
My operation system: Windows 10.
Please help.
Thank you.