项目:freeVM
文件:LookAndFeelTest.java
public Result testMakeComponentInputMap() {
Object[] bindings = new Object[]{};
JComponent component = new JComponent() { };
try {
ComponentInputMap map = LookAndFeel.makeComponentInputMap(component,bindings);
checkForNull( map,"map created from zero-length array is not empty");
if (map.getComponent() != component) {
return Failed("wrong component in the map");
}
bindings = new Object[]{Keystroke.getKeystroke('a'),new Object(),Keystroke.getKeystroke( 'b')};
try {
LookAndFeel.makeComponentInputMap(component,bindings );
return Failed("Expect an RuntimeException");
} catch (RuntimeException ee ) {}
bindings = createBindings();
if (!checkIsSubset( bindings,buildBindings( LookAndFeel.makeComponentInputMap(component,bindings )))) {
return Failed("Failed to make input map");
}
} catch (RuntimeException e) {
// e.printstacktrace();
return Failed("Unexpected exception of " + e.getClass());
}
return passed();
}
项目:SOEN6471-FreeCol
文件:EuropePanel.java
public EuropeButton(String text,int keyEvent,String command,ActionListener listener) {
setopaque(true);
setText(text);
setActionCommand(command);
addActionListener(listener);
InputMap closeInputMap = new ComponentInputMap(this);
closeInputMap.put(Keystroke.getKeystroke(keyEvent,false),"pressed");
closeInputMap.put(Keystroke.getKeystroke(keyEvent,true),"released");
SwingUtilities.replaceUIInputMap(this,JComponent.WHEN_IN_FOCUSED_WINDOW,closeInputMap);
enterPressesWhenFocused(this);
}
项目:incubator-netbeans
文件:OutlineTable.java
private void filterInputMap(JComponent component,int condition) {
InputMap imap = component.getInputMap(condition);
if (imap instanceof ComponentInputMap) {
imap = new F8FilterComponentInputMap(component,imap);
} else {
imap = new F8FilterInputMap(imap);
}
component.setInputMap(condition,imap);
}
项目:freecol
文件:EuropePanel.java
public EuropeButton(String text,closeInputMap);
}
项目:FreeCol
文件:EuropePanel.java
public EuropeButton(String text,closeInputMap);
}
项目:mobac
文件:MapKeyboardController.java
public MapKeyboardController(PreviewMap map,boolean enabled) {
super(map);
inputMap = new ComponentInputMap(map);
ActionMap actionMap = map.getActionMap();
// map moving
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_RIGHT,"MOVE_RIGHT");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_LEFT,"MOVE_LEFT");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_UP,"MOVE_UP");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,"MOVE_DOWN");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_RIGHT,"STOP_MOVE_HORIZONTALLY");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_LEFT,"STOP_MOVE_HORIZONTALLY");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_UP,"STOP_MOVE_VERTICALLY");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,"STOP_MOVE_VERTICALLY");
// zooming. To avoid confusion about which modifier key to use,// we just add all keys left of the space bar
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_UP,InputEvent.CTRL_DOWN_MASK,"ZOOM_IN");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_UP,InputEvent.Meta_DOWN_MASK,InputEvent.ALT_DOWN_MASK,"ZOOM_IN");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,"ZOOM_OUT");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_DOWN,"ZOOM_OUT");
// map selection
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_LEFT,"PREVIoUS_MAP");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_LEFT,"PREVIoUS_MAP");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_RIGHT,"NEXT_MAP");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_RIGHT,"NEXT_MAP");
inputMap.put(Keystroke.getKeystroke(KeyEvent.VK_F5,"REFRESH");
// action mapping
actionMap.put("MOVE_RIGHT",new MoveRightAction());
actionMap.put("MOVE_LEFT",new MoveLeftAction());
actionMap.put("MOVE_UP",new MoveUpAction());
actionMap.put("MOVE_DOWN",new MoveDownAction());
actionMap.put("STOP_MOVE_HORIZONTALLY",new StopMoveHorizontallyAction());
actionMap.put("STOP_MOVE_VERTICALLY",new StopMoveVerticallyAction());
actionMap.put("ZOOM_IN",new ZoomInAction());
actionMap.put("ZOOM_OUT",new ZoomOutAction());
actionMap.put("NEXT_MAP",new NextMapAction());
actionMap.put("PREVIoUS_MAP",new PrevIoUsMapAction());
actionMap.put("REFRESH",new RefreshAction());
if (enabled)
enable();
}
项目:mobac
文件:MapKeyboardController.java
@Override
public void disable() {
map.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,new ComponentInputMap(map));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。