本文整理汇总了Java中y.view.Graph2DViewActions类的典型用法代码示例。如果您正苦于以下问题:Java Graph2DViewActions类的具体用法?Java Graph2DViewActions怎么用?Java Graph2DViewActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Graph2DViewActions类属于y.view包,在下文中一共展示了Graph2DViewActions类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import y.view.Graph2DViewActions; //导入依赖的package包/类
public static <NodeType extends ZyGraphNode<?>> void register(
final AbstractZyGraph<NodeType, ?> graph) {
final Graph2DView view = graph.getView();
final Graph2DViewActions actions = new Graph2DViewActions(view);
final ActionMap amap = actions.createActionMap();
final InputMap imap = actions.createDefaultInputMap(amap);
view.setActionMap(amap);
view.setInputMap(JComponent.WHEN_FOCUSED, imap);
view.getCanvasComponent().setActionMap(amap);
view.getCanvasComponent().setInputMap(JComponent.WHEN_FOCUSED, imap);
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "DOWN");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "UP");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "LEFT");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "RIGHT");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0), "+");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0), "-");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_M, 0), "m");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_S, 0), "s");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LESS, 0), "<");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK), "SELECT_VISIBLE_NODES");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_DOWN_MASK),
"COPY_CONTENT_FROM_SELECTED_NODES");
amap.remove(Graph2DViewActions.DELETE_SELECTION);
amap.remove(Graph2DViewActions.EDIT_LABEL);
registerActions(graph);
}
示例2: configureKeyboardActions
import y.view.Graph2DViewActions; //导入依赖的package包/类
private void configureKeyboardActions() {
Graph2DViewActions keyboardActions = new Graph2DViewActions(
abstractAntibodyView);
ActionMap defaultActions = keyboardActions.createActionMap();
InputMap defaultInputMap = keyboardActions
.createDefaultInputMap(defaultActions);
defaultInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
Graph2DViewActions.DELETE_SELECTION);
defaultActions.put(Graph2DViewActions.DELETE_SELECTION,
new GraphDeleteAction());
abstractAntibodyView.getCanvasComponent().setActionMap(defaultActions);
abstractAntibodyView.getCanvasComponent().setInputMap(
JComponent.WHEN_FOCUSED, defaultInputMap);
}
示例3: registerViewActions
import y.view.Graph2DViewActions; //导入依赖的package包/类
protected void registerViewActions() {
// register keyboard actions
actions = new Graph2DViewActions(view);
amap = actions.createActionMap();
InputMap imap = actions.createDefaultInputMap(amap);
// replace the default delete action with a customized one
amap.put(Graph2DViewActions.DELETE_SELECTION, new DeleteAction(this,
_ownerCode));
if (!isDeletionEnabled()) {
amap.remove(Graph2DViewActions.DELETE_SELECTION);
}
view.getCanvasComponent().setActionMap(amap);
view.getCanvasComponent().setInputMap(JComponent.WHEN_FOCUSED, imap);
// create new clipboard.
SequenceGraph2DClipboard clipboard = new SequenceGraph2DClipboard(view);
clipboard.setCopyFactory(new GraphDeepCopyFactory());
// get Cut action from clipboard
cutAction = clipboard.getCutAction();
cutAction.putValue(Action.SMALL_ICON,
new ImageIcon(GUIBase.class.getResource("resource/Cut16.gif")));
cutAction.putValue(Action.SHORT_DESCRIPTION, "Cut");
// get Copy action from clipboard
copyAction = clipboard.getCopyAction();
copyAction
.putValue(
Action.SMALL_ICON,
new ImageIcon(GUIBase.class
.getResource("resource/Copy16.gif")));
copyAction.putValue(Action.SHORT_DESCRIPTION, "Copy");
// get Paste action from clipboard
pasteAction = clipboard.getPasteAction();
pasteAction
.putValue(
Action.SMALL_ICON,
new ImageIcon(GUIBase.class
.getResource("resource/Paste16.gif")));
pasteAction.putValue(Action.SHORT_DESCRIPTION, "Paste");
}