Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
635 bytes
|
Line | |
---|
1 | package com.framsticks.util.swing; |
---|
2 | |
---|
3 | import javax.swing.*; |
---|
4 | |
---|
5 | /** |
---|
6 | * Author: Piotr Śniegowski |
---|
7 | */ |
---|
8 | public class KeyboardModifier { |
---|
9 | final InputMap inputMap; |
---|
10 | final ActionMap actionMap; |
---|
11 | |
---|
12 | public KeyboardModifier(JComponent component, int condition) { |
---|
13 | inputMap = component.getInputMap(condition); |
---|
14 | actionMap = component.getActionMap(); |
---|
15 | } |
---|
16 | |
---|
17 | public KeyboardModifier join(KeyStroke newOne, KeyStroke oldOne) { |
---|
18 | inputMap.put(newOne, inputMap.get(oldOne)); |
---|
19 | return this; |
---|
20 | } |
---|
21 | |
---|
22 | public KeyboardModifier add(KeyStroke keyStroke, String name, Action action) { |
---|
23 | inputMap.put(keyStroke, name); |
---|
24 | actionMap.put(name, action); |
---|
25 | return this; |
---|
26 | } |
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.