Hi Torsten, Please see: http://lists.canoo.com/mailman/private/ulc-developer/2004/000925.html.
On which component do you want to catch VK_LEFT key? Because, it also
depends on the key map of the component. For e.g., please see the snippet
below in which VK_LEFT does not work for ULCTextField but works for
ULCButton.
Thanks and regards,
Janak
----------------
import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBoxPane;
import com.ulcjava.base.application.ULCButton;
import com.ulcjava.base.application.ULCComponent;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCTextField;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.event.IKeyListener;
import com.ulcjava.base.application.event.KeyEvent;
import com.ulcjava.base.application.util.KeyStroke;
import com.ulcjava.base.development.DevelopmentRunner;
public class KeyEventsSnippet extends AbstractApplication {
public void start() {
ULCButton but = new ULCButton("Button");
final ULCTextField field = new ULCTextField(10);
field.addKeyListener(new IKeyListener() {
public void keyTyped(KeyEvent event) {
System.out.println("Key Typed: " +
event.getKeyChar());
}
});
but.addKeyListener(new IKeyListener() {
public void keyTyped(KeyEvent event) {
System.out.println("Key Typed: " +
event.getKeyChar());
}
});
field.registerKeyboardAction(new IActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("Keyboard Action");
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
ULCComponent.WHEN_IN_FOCUSED_WINDOW);
but.registerKeyboardAction(new IActionListener() {
public void actionPerformed(ActionEvent event) {
System.out.println("Keyboard Action");
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
ULCComponent.WHEN_IN_FOCUSED_WINDOW);
ULCBoxPane content = new ULCBoxPane(true);
content.add(ULCBoxPane.BOX_EXPAND_TOP, field);
content.add(ULCBoxPane.BOX_EXPAND_BOTTOM, but);
ULCFrame frame = new ULCFrame("ULCTableColDragSnippet");
frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
frame.add(content);
frame.setSize(300, 300);
frame.setVisible(true);
}
public static void main(String[] args) {
DevelopmentRunner.setApplicationClass(KeyEventsSnippet.class);
DevelopmentRunner.run();
}
}
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of Hofmann,
>Torsten
>Sent: Thursday, October 26, 2006 6:48 PM
>To: [email protected]
>Subject: [ULC-developer] Method public void keyTyped(KeyEvent event)
>does not catch the VK_LEFT
>
>
>Hello
>
>Is this correct, that the keyTyped Method does not catch the VK_LEFT key?
>Is it possible to change this?
>
>
>Regards
>
>Torsten Hofmann
>Dipl. - Informatiker (FH)
>IT Consultant Business Integration
>
>Würth Phoenix GmbH
>Drillberg 6
>D-97980 Bad Mergentheim
>
>Phone: +49 7931 91 6284
>Fax: +49 7931 91 7284
>E-Mail: [EMAIL PROTECTED]
>Website: www.wuerth-phoenix.de
>
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer
KeyEventsSnippet.java
Description: Binary data
KeyEventsSnippet.java
Description: Binary data
