Ctrl « Event « Java Swing Q&A





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

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.VK_F1, ...

2. Java Swing KeyStrokes: how to make CTRL-modifier work    stackoverflow.com

In the following program, why does hitting the 'a' key print "hello, world" while hitting 'CTRL-a' doesn't?

import java.awt.event.*;
import javax.swing.*;

public class KeyStrokeTest {
    public static void main(String[] args) {
 ...

3. How do I implement Ctrl+Z / Command+Z in Java/Swing?    stackoverflow.com

I'm working on a little Java applet that needs undo/redo functionality. Here's code to set up the hotkeys (works great on Windows). My question is: how do I make it use ...

4. Prevent keyTyped() from triggering when pressing ctrl+s    stackoverflow.com

I have an accelerator for ctrl+s and at the same time a keylistener on a JTextField listening for keyTyped(). But when i press ctrl+s i dont want it to trigger keyTyped(). ...

5. How to catch a CTRL + mouseWheel event with InputMap    stackoverflow.com

I've implemented some hotkeys for a Swing application with InputMap like

    getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK), "selectAll");
getActionMap().put("selectAll", new SelectAllAction());
it's working fine. Now, how can I do the same thing if I ...

6. How would I go about including Ctrl+Click as a right-click? (Java)    stackoverflow.com

I have an option to right-click. But users that need to use Ctrl + Click cannot use right-click because Java only allows for the right-click button to be hit. Does anyone know ...

7. Trapping CTRL and ALT keys    coderanch.com

8. Accelerators: with and without ctrl key    coderanch.com

I would like to define accelerators that do not use the control key. The semantics for accelerators seem to be as follows: If the accelerator specifies control (e.g. "ctrl C") control is required. Otherwise, (e.g. "C"), control is optional. This means that if I have both ("C" = calibrate, and "Ctrl C" = copy), the "C" gets in the way of ...

9. ALT_MASK and CTRL_MASK    coderanch.com

i have to make a menu with a keyboard accelerator key combination of Ctrl+Alt+A. the following line will make a keyboard shortcut of Ctrl+A: jmiAdd.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); on the menu will be the light blue letters "Ctrl-A" next to the menu entry, plus you can press Ctrl-A at any time to execute the instruction. by changing CTRL_MASK to ALT_MASK, you change ...





11. How to enable CTRL+C to perform action instead of coping to clipboard?    coderanch.com

I didn't found solution there, I don't want to remove key binding but to use ctrl-c for specific copy action. I have in popup window defined copy action and ctrl-c is binded to that action. If I open popup and then press ctrl-c my copy action is triggered, but if I press ctrl-c without opening popup than my action isn't catched, ...

14. action performed method for ALT+CTRL+DEL    coderanch.com

If the resources are application global and should be disposed no matter what, then you can use shutdownhooks. But note that in some rare cases like native call crash, the method may not call. But in any case, this is the best shot you got. You simly need to pass a Thread as an argument to the above method. When the ...

15. Need to restrict ctrl+c, ctrl+v, ctrl+x    coderanch.com

16. Ctrl+X,Ctrl+C,Ctrl+V not working!    coderanch.com

Hi All, I am facing an issue where in my GUI (which is developed using Swings), the short cut keys Ctrl+X,Ctrl+C,Ctrl+V keys not working for text,panel and cell fields (I didnt check for all the other fileds which can be editable). Our servers which runs on solaris use CDE/JDS environments. (CDE- Common Desktop Env., JDS- Java Desktop System). I found the ...





17. Short-cut key issue in SWT (Ctrl+C and Ctrl+v)    coderanch.com

Hi, Can anybody tell me how to handle Ctrl+c and Ctrl+v key releases in an Eclipse application? Am currently using Eclipse 3.5. The key bindings has been defined in the PlugIn.xml. As soon as i start the application if i do Ctrl+c or Ctrl+v the events are not getting triggered. But the event triggers only after i manuallay open the EDIT ...

18. Check if ctrl is pressed in an ActionEvent    java-forums.org

Greetings, This is my first time here, so I'll introduce myself first. My name is Itai and I'm from Israel, I took a 10 month course in java that ended about a year ago. I am now working as a software developer for a company called EASA software. My question is regarding a personal project. I have an ActionListener listening to ...

19. Run method on Ctrl+Shift+D    java-forums.org