CTRL « Button « Java Swing Q&A





1. CTRL Mask on JButton    coderanch.com

2. Checking for CTRL+s when a JButton is pushed    coderanch.com

I'd like to be able to check when a JButton is pushed whether the CTRL and "S" keys are both pushed. Right now I only check for the CTRL or SHFT buttons using he following code: ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { short preset; try { preset = Short.parseShort(e.getActionCommand()); if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) { ...

3. Ctrl+X on JButton    java-forums.org

Thanks m00nchile, I really appreciate your help but I did my research before hand and I had also seen that tutorial... it implements mnemonics which add Alt+x kind of shorcuts but I want Ctrl+x .... I also tried to implement keylisteners but they require the button to have focuswhen i press ctrl+x (whats the point of adding shortcut then)... Can you ...