keyevent

Java Swing: Ctrl+F1 does not work globally, but each other key combination

Hello, I have a swing gui with a tabbed pane in the north. Several key events are added to its input map: InputMap paneInputMap = pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); paneInputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_E, KeyEvent.CTRL_MASK ), "finish"); paneInputMap.put( KeyStroke.getKeyStroke( KeyEvent.V...

How to catch Control-V in C# app?

I've tried to override WndProc, but no message show up on paste event. Then I tried to create custom filter and using method PreFilterMessage I was able to catch message with value 257 (KEYUP event), but that's not enough... ...

Simulate a key held down in Java

I'm looking to simulate the action of holding a keyboard key down for a short period of time in Java. I would expect the following code to hold down the A key for 5 seconds, but it only presses it once (produces a single 'a', when testing in Notepad). Any idea if I need to use something else, or if I'm just using the awt.Robot class wron...

Key events on application level in Java

Is it possible to be notified of key events on an application level and not on a Component level? What i mean by application level is not having a swing component receive key events but to have a special class listen to system wide key events. This could be used in an app with no GUI for instance or when a more global handling of key ev...

capture key events in wxdialog linux

capturing EVT_KEY_UP or EVT_CHAR does not work, but does under windows? Any hints ? ...

KeyListener(KeyPressed) doesn't working

I try to make it like this : Try using a key listener to detect each time the user enters text into the field. Each time the key event is triggered, get the length() of the text in the JTextField. If the length >= limit, then disable editing. However, if the delete key is pressed, remove the last character in the JTextField and setEditab...

how to add a datagrid row on key down event?

I have a datagrid with one row intially. When I click on the first row, i.e on key down event, I want another row to be added. Earlier I had a button, on clicking which I added the row. But now I want the row to be added automatically once I click the first row. How to do that? I added keydown event to the datagrid, but it threw some...

Java KeyAdapter

I am somewhat unfamiliar with how the Java KeyAdapter works, and am getting unexpected results with the following code using KeyAdapter. The problem occurs when a key is pressed while another key is already held down, regardless of whether isKeyPressed() is called. Note: I know this is a lot of code, and I apologize. I tried the best I ...

java swing- escape key event causes classCastException in look and feel

Good morning everyone! I need your help! My application processes patient records. In the main frame user can open several internal frames. Each internal frame contains a tabbed pane and each tab created by the user contains a form where he can enter patient's data and a jtable where all added patients are shown. When the user clicks ...

Java: How to immediately send changes in a text field to a file?

Is it hard to do the following with the Java? First I need to generate a window with a text field (no buttons, nothing, just a text field). Than, when a user types a symbol in the text filed, program immediately stores information about this in a file (which symbol was typed and when). That's it. ...

How do I change the background color of a frame in Java from another class?

Hi, I have the following: import javax.swing.JFrame; public class Directions { public Directions(){ JFrame frame = new JFrame("Direction"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new DirectionPanel()); frame.pack(); frame.setVisible(true); } ...

Find the first character of input in a textbox

I am stuck in implementing the following: User starts typing in a textbox. The javascript on page captures the first character typed, validates that it is an english alphabet (a-z,A-Z) and converts it to lowercase (if necessary). Make an XMLHttp request based on the input (i.e. if first input character is a, get a.xml, if b get b.xml a...

jquery how to catch enter key and change event to tab

I want a jquery solution, I must be close, what needs to be done? $('html').bind('keypress', function(e) { if(e.keyCode == 13) { return e.keyCode = 9; //set event key to tab } }); I can return false and it prevents the enter key from being pressed, I thought I could just change the keyCode to 9 to make it tab ...

C# KeyEvent doesn't log the enter/return key

Hey all, I've been making this login form in C# and I wanted to 'submit' all the data as soon as the user either clicks on submit or presses the enter/return key. I've been testing a bit with KeyEvents but nothing so far worked. void tbPassword_KeyPress(object sender, KeyPressEventArgs e) { MessageBox.Show(e.KeyChar.ToString()); }...

how to capture key repeats with javascript

i have an asp.net form and an asp:textbox. i have a problem when the user presses and HOLDS a key down. the user selects the text box and then presses and holds '9' until the text box fills with 9s. Is there any way to detect this situation? Is there a way to stop key repeats when the key is held down? ...

Long key press handling in android 1.5

Hi, I want to handle key press and long key press for the key code KEYCODE_BACK(back button). can any one suggest me how to do this in android 1.5(API level 3). Here is the code. public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if(event.getRepeatCount()==0) { ...

switching default keyevents actions after key combinations

I need to change default actions of two events. When I press "enter" one action occurs, when I press "shift-enter" another. I need to switch it. I means if I press "enter" than "shift-enter" action occurs. I tried something like this but if doesn't work. f(evt.keyCode == 13) { if(!evt.shiftKey){ evt.preventDefault(); ...

TextField Listener

Hi, there's a swing JTextField, and I want to add a listener, so whenever the users types a single letter, there's an event. There's a ValueChanged event in scala api, but I don't get it what's it's peer. So which one Listener should I use? KeyListener and implement reasonably just one method? ...

Windows.Forms.Control derived class with TabStop and key-events

I've got a control that derives from Forms.Control, it handles mouse events and paint events just fine, but I'm having a problem with key events. I need to handle Left arrow and Right arrow, but so far the Tab control that contains my class eats these. How do I make this control selectable, focusable? ...

Key Events in TabActivities?

I have a TabActivity and want to catch and handle presses of HOME and BACK. Where do I need to catch these events? In my subclass of TabActivity I implement the following: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { // Code handling } return super.onKeyDown(keyCode, event); ...