本文整理了Java中javax.swing.JTree.getActionMap()
方法的一些代码示例,展示了JTree.getActionMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getActionMap()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getActionMap
暂无
代码示例来源:origin: stackoverflow.com
JTree tree = new JTree();
...
tree.getActionMap().put( "cut", null );
tree.getActionMap().put( "copy", null );
tree.getActionMap().put( "paste", null );
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates
private void invokeInplaceEditing () {
if (startEditing == null) {
Object o = tree.getActionMap ().get ("startEditing"); // NOI18N
if (o != null && o instanceof Action) {
startEditing = (Action) o;
}
}
assert startEditing != null : "startEditing is on tree ActionMap " + Arrays.asList (tree.getActionMap ().keys ());
startEditing.actionPerformed (new ActionEvent (tree, 0, "startEditing")); // NOI18N
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-templates
private TemplateTreeView() {
tree.getActionMap().put ("startEditing", new RenameTemplateAction()); // NOI18N
}
代码示例来源:origin: stackoverflow.com
JTree tree = new JTree(new String[]{"a", "b", "c"});
tree.setEditable(true);
InputMap m = tree.getInputMap(JComponent.WHEN_FOCUSED);
KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0);
m.put(ks, "actionMapKey");
tree.getActionMap().put("actionMapKey", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
// do your stuff
}
});
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
KeyStrokes.CTRL_7, KeyStrokes.CTRL_8, KeyStrokes.CTRL_9,};
for (int n = 0; n < keyStrokes.length; n++) {
treevar.getActionMap().put(ActionNames.QUICK_COMPONENT + String.valueOf(n), quickComponent);
inputMap.put(keyStrokes[n], ActionNames.QUICK_COMPONENT + String.valueOf(n));
代码示例来源:origin: realXuJiang/bigtable-sql
private void initRenderer()
{
DefaultTreeCellRenderer treeCellRenderer = new DefaultTreeCellRenderer()
{
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
{
return modifyRenderer(super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus), value);
}
};
_tree.setCellRenderer(treeCellRenderer);
AbstractAction cancelCutAction = new AbstractAction()
{
public void actionPerformed(ActionEvent actionEvent)
{
if (null != _pathsToPaste && PasteMode.CUT.equals(_pasteMode))
{
_pathsToPaste = null;
_tree.repaint();
}
}
};
KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
_tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeStroke, "cancelCutAction");
_tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeStroke, "cancelCutAction");
_tree.getInputMap(JComponent.WHEN_FOCUSED).put(escapeStroke, "cancelCutAction");
_tree.getActionMap().put("cancelCutAction", cancelCutAction);
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
private void initRenderer()
{
DefaultTreeCellRenderer treeCellRenderer = new DefaultTreeCellRenderer()
{
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
{
return modifyRenderer(super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus), value);
}
};
_tree.setCellRenderer(treeCellRenderer);
AbstractAction cancelCutAction = new AbstractAction()
{
public void actionPerformed(ActionEvent actionEvent)
{
if (null != _pathsToPaste && PasteMode.CUT.equals(_pasteMode))
{
_pathsToPaste = null;
_tree.repaint();
}
}
};
KeyStroke escapeStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
_tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeStroke, "cancelCutAction");
_tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeStroke, "cancelCutAction");
_tree.getInputMap(JComponent.WHEN_FOCUSED).put(escapeStroke, "cancelCutAction");
_tree.getActionMap().put("cancelCutAction", cancelCutAction);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
Action selectPrevious = _tree.getActionMap().get( "selectPrevious" );
selectPrevious.actionPerformed( new ActionEvent( _tree, 0, "selectPrevious" ) );
e.consume();
Action selectNext = _tree.getActionMap().get( "selectNext" );
selectNext.actionPerformed( new ActionEvent( _tree, 0, "selectNext" ) );
e.consume();
Action scrollUpChangeSelection = _tree.getActionMap().get( "scrollUpChangeSelection" );
scrollUpChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollUpChangeSelection" ) );
e.consume();
Action scrollDownChangeSelection = _tree.getActionMap().get( "scrollDownChangeSelection" );
scrollDownChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollDownChangeSelection" ) );
e.consume();
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT )
Action selectPrevious = _tree.getActionMap().get( "selectPrevious" );
selectPrevious.actionPerformed( new ActionEvent( _tree, 0, "selectPrevious" ) );
e.consume();
e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT )
Action selectNext = _tree.getActionMap().get( "selectNext" );
selectNext.actionPerformed( new ActionEvent( _tree, 0, "selectNext" ) );
e.consume();
Action scrollUpChangeSelection = _tree.getActionMap().get( "scrollUpChangeSelection" );
scrollUpChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollUpChangeSelection" ) );
e.consume();
Action scrollDownChangeSelection = _tree.getActionMap().get( "scrollDownChangeSelection" );
scrollDownChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollDownChangeSelection" ) );
e.consume();
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_KP_LEFT )
Action selectPrevious = _tree.getActionMap().get( "selectPrevious" );
selectPrevious.actionPerformed( new ActionEvent( _tree, 0, "selectPrevious" ) );
e.consume();
e.getKeyCode() == KeyEvent.VK_RIGHT || e.getKeyCode() == KeyEvent.VK_KP_RIGHT )
Action selectNext = _tree.getActionMap().get( "selectNext" );
selectNext.actionPerformed( new ActionEvent( _tree, 0, "selectNext" ) );
e.consume();
Action scrollUpChangeSelection = _tree.getActionMap().get( "scrollUpChangeSelection" );
scrollUpChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollUpChangeSelection" ) );
e.consume();
Action scrollDownChangeSelection = _tree.getActionMap().get( "scrollDownChangeSelection" );
scrollDownChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollDownChangeSelection" ) );
e.consume();
代码示例来源:origin: xSAVIKx/AndroidScreencast
/**
* If the node is cancelable an escape Action is registered in the tree's InputMap and ActionMap that will cancel the execution
*
* @param tree the tree
* @param worker the worker to cancel
*/
protected void registerSwingWorkerForCancel(JTree tree, com.github.xsavikx.androidscreencast.ui.worker.SwingWorker<MutableTreeNode[], ?> worker) {
if (!cancelable) {
return;
}
tree.getInputMap().put(ESCAPE_KEY, ESCAPE_ACTION_NAME);
Action action = tree.getActionMap().get(ESCAPE_ACTION_NAME);
if (action == null) {
CancelWorkersAction cancelWorkerAction = new CancelWorkersAction();
cancelWorkerAction.addSwingWorker(worker);
tree.getActionMap().put(ESCAPE_ACTION_NAME, cancelWorkerAction);
} else {
if (action instanceof CancelWorkersAction) {
CancelWorkersAction cancelAction = (CancelWorkersAction) action;
cancelAction.addSwingWorker(worker);
}
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
Action selectPrevious = _tree.getActionMap().get( "selectPrevious" );
selectPrevious.actionPerformed( new ActionEvent( _tree, 0, "selectPrevious" ) );
e.consume();
Action selectNext = _tree.getActionMap().get( "selectNext" );
selectNext.actionPerformed( new ActionEvent( _tree, 0, "selectNext" ) );
e.consume();
Action scrollUpChangeSelection = _tree.getActionMap().get( "scrollUpChangeSelection" );
scrollUpChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollUpChangeSelection" ) );
e.consume();
Action scrollDownChangeSelection = _tree.getActionMap().get( "scrollDownChangeSelection" );
scrollDownChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollDownChangeSelection" ) );
e.consume();
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
Action selectPrevious = _tree.getActionMap().get( "selectPrevious" );
selectPrevious.actionPerformed( new ActionEvent( _tree, 0, "selectPrevious" ) );
e.consume();
Action selectNext = _tree.getActionMap().get( "selectNext" );
selectNext.actionPerformed( new ActionEvent( _tree, 0, "selectNext" ) );
e.consume();
Action scrollUpChangeSelection = _tree.getActionMap().get( "scrollUpChangeSelection" );
scrollUpChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollUpChangeSelection" ) );
e.consume();
Action scrollDownChangeSelection = _tree.getActionMap().get( "scrollDownChangeSelection" );
scrollDownChangeSelection.actionPerformed( new ActionEvent( _tree, 0, "scrollDownChangeSelection" ) );
e.consume();
代码示例来源:origin: xSAVIKx/AndroidScreencast
/**
* Remove the swingWorker from the cancellable task of the tree
*
* @param tree
* @param worker
*/
protected void unRegisterSwingWorkerForCancel(JTree tree, com.github.xsavikx.androidscreencast.ui.worker.SwingWorker<MutableTreeNode[], ?> worker) {
if (!cancelable) {
return;
}
Action action = tree.getActionMap().get(ESCAPE_ACTION_NAME);
if (action != null && action instanceof CancelWorkersAction) {
CancelWorkersAction cancelWorkerAction = new CancelWorkersAction();
cancelWorkerAction.removeSwingWorker(worker);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
tree.getActionMap().put("enter_action", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (((GOETreeNode)tree.getLastSelectedPathComponent()).isLeaf()) {
代码示例来源:origin: Waikato/weka-trunk
tree.getActionMap().put("enter_action", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (((GOETreeNode)tree.getLastSelectedPathComponent()).isLeaf()) {
代码示例来源:origin: org.zaproxy/zap
(KeyStroke) delContextAction.getValue(DeleteContextAction.ACCELERATOR_KEY),
DeleteContextAction.ACTION_NAME);
treeContext.getActionMap().put(DeleteContextAction.ACTION_NAME, delContextAction);
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
_tree.setRowHeight( 20 );
_tree.setVisibleRowCount( 10 );
_tree.getActionMap().put( "scrollUpChangeSelection", new AbstractAction()
_tree.getActionMap().put( "scrollDownChangeSelection", new AbstractAction()
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
_tree.setRowHeight( 20 );
_tree.setVisibleRowCount( 10 );
_tree.getActionMap().put( "scrollUpChangeSelection", new AbstractAction()
_tree.getActionMap().put( "scrollDownChangeSelection", new AbstractAction()
代码示例来源:origin: org.zaproxy/zap
treeAlert.getActionMap().put(deleteAlertKey, new AbstractAction() {
内容来源于网络,如有侵权,请联系作者删除!