本文整理汇总了Java中javax.swing.plaf.InputMapUIResource.put方法的典型用法代码示例。如果您正苦于以下问题:Java InputMapUIResource.put方法的具体用法?Java InputMapUIResource.put怎么用?Java InputMapUIResource.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.plaf.InputMapUIResource
的用法示例。
在下文中一共展示了InputMapUIResource.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createValue
import javax.swing.plaf.InputMapUIResource; //导入方法依赖的package包/类
public Object createValue(UIDefaults table)
{
InputMapUIResource im = new InputMapUIResource();
for (int i = 0; 2 * i + 1 < bind.length; ++i)
{
Object curr = bind[2 * i];
if (curr instanceof KeyStroke)
im.put((KeyStroke) curr, bind[2 * i + 1]);
else
im.put(KeyStroke.getKeyStroke((String) curr),
bind[2 * i + 1]);
}
return im;
}
示例2: remapKey
import javax.swing.plaf.InputMapUIResource; //导入方法依赖的package包/类
/**
* Remap a swing default key binding to a native one, if needed.
*
* @param map keymap to be modified
* @param key
* @param defaultModifier swing default modifier key for the action
* @param nativeModifier native modifier key for the action
*/
private void remapKey(InputMapUIResource map, int key, int defaultModifier,
int nativeModifier) {
KeyStroke defaultKey = KeyStroke.getKeyStroke(key, defaultModifier);
Object action = map.get(defaultKey);
KeyStroke nativeKey = KeyStroke.getKeyStroke(key, nativeModifier);
if (!nativeKey.equals(defaultKey)) {
map.remove(defaultKey);
map.put(nativeKey, action);
}
}
示例3: setUp
import javax.swing.plaf.InputMapUIResource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
ui = new BasicButtonUI();
previousBorder = UIManager.getBorder("Button.border");
uiInputMap = new InputMapUIResource();
uiInputMap.put(KeyStroke.getKeyStroke("SPACE"), "pressed");
uiInputMap.put(KeyStroke.getKeyStroke("released SPACE"), "released");
uiInputMap.put(KeyStroke.getKeyStroke("ENTER"), "pressed");
uiInputMap.put(KeyStroke.getKeyStroke("released ENTER"), "released");
}
示例4: fixCtrlShiftO
import javax.swing.plaf.InputMapUIResource; //导入方法依赖的package包/类
private static void fixCtrlShiftO(String component) {
InputMapUIResource iomap = (InputMapUIResource)UIManager.get(component);
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK);
iomap.put(keyStroke, null);
}