当前位置: 首页>>代码示例>>Java>>正文


Java Graph2DViewActions类代码示例

本文整理汇总了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);
}
 
开发者ID:google,项目名称:binnavi,代码行数:32,代码来源:CRegisterHotKeys.java

示例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);
}
 
开发者ID:PistoiaHELM,项目名称:HELMAntibodyEditor,代码行数:15,代码来源:AntibodyEditorPane.java

示例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");
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:47,代码来源:GUIBase.java


注:本文中的y.view.Graph2DViewActions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。