本文整理了Java中javax.swing.AbstractButton.getActionMap()
方法的一些代码示例,展示了AbstractButton.getActionMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractButton.getActionMap()
方法的具体详情如下:
包路径:javax.swing.AbstractButton
类名称:AbstractButton
方法名:getActionMap
暂无
代码示例来源:origin: com.jalalkiswani/jk-desktop
final ActionMap amap = btn.getActionMap();
代码示例来源:origin: de.sciss/scisslib
/**
* Convenience method that will add new
* corresponding entries in a button's input and action map,
* such that a given <code>KeyStroke</code> will cause a
* <code>DoClickAction</code> to be performed on that button.
* The key stroke is performed whenever the button is in
* the current focused window.
*
* @param comp an <code>AbstractButton</code> to which a
* a new keyboard action is attached.
* @param stroke the <code>KeyStroke</code> which causes a
* click on the button.
*
* @see DoClickAction
* @see javax.swing.JComponent#getInputMap( int )
* @see javax.swing.JComponent#getActionMap()
* @see javax.swing.JComponent#WHEN_IN_FOCUSED_WINDOW
*/
public static void createKeyAction( AbstractButton comp, KeyStroke stroke )
{
comp.getInputMap( JComponent.WHEN_IN_FOCUSED_WINDOW ).put( stroke, "shortcut" );
comp.getActionMap().put( "shortcut", new DoClickAction( comp ));
}
代码示例来源:origin: stackoverflow.com
public static void clickOnKey(
final AbstractButton button, String actionName, int key )
{
button.getInputMap( JButton.WHEN_IN_FOCUSED_WINDOW )
.put( KeyStroke.getKeyStroke( key, 0 ), actionName );
button.getActionMap().put( actionName, new AbstractAction()
{
@Override
public void actionPerformed( ActionEvent e )
{
button.doClick();
}
} );
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-application-swing
abstractButton.getActionMap().put(key, abstractButton.getAction());
内容来源于网络,如有侵权,请联系作者删除!