本文整理了Java中javax.swing.JMenuItem.setActionCommand()
方法的一些代码示例,展示了JMenuItem.setActionCommand()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setActionCommand()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setActionCommand
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
copy.setActionCommand((String)TransferHandler.getCopyAction().
getValue(Action.NAME));
copy.addActionListener(new TransferActionListener());
代码示例来源:origin: stanfordnlp/CoreNLP
copy.setActionCommand((String) TransferHandler.getCopyAction()
.getValue(Action.NAME));
copy.addActionListener(new TregexGUI.TransferActionListener());
代码示例来源:origin: apache/geode
private void createMenu() {
JMenuBar menuBar = new JMenuBar();
JMenu sequenceMenu = new JMenu("Sequence");
sequenceMenu.setMnemonic(KeyEvent.VK_S);
sequenceMenu.getAccessibleContext()
.setAccessibleDescription("The only menu in this program that has menu items");
menuBar.add(sequenceMenu);
JMenuItem selectGraphs = new JMenuItem("Choose Graphs", KeyEvent.VK_G);
selectGraphs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, ActionEvent.ALT_MASK));
selectGraphs.getAccessibleContext().setAccessibleDescription("Select what graphs to display");
selectGraphs.setActionCommand("selectgraphs");
selectGraphs.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showGraphSelector();
}
});
sequenceMenu.add(selectGraphs);
frame.setJMenuBar(menuBar);
}
代码示例来源:origin: apache/tika
private void addMenuItem(
JMenu menu, String title, String command, int key) {
JMenuItem item = new JMenuItem(title, key);
item.setActionCommand(command);
item.addActionListener(this);
menu.add(item);
}
代码示例来源:origin: magefree/mage
private void initPopupMenuTriggerOrder() {
ActionListener actionListener = e -> handleTriggerOrderPopupMenuEvent(e);
popupMenuTriggerOrder = new JPopupMenu();
// String tooltipText = "";
JMenuItem menuItem;
menuItem = new JMenuItem("Put this ability always first on the stack");
menuItem.setActionCommand(CMD_AUTO_ORDER_FIRST);
menuItem.addActionListener(actionListener);
popupMenuTriggerOrder.add(menuItem);
menuItem = new JMenuItem("Put this ability always last on the stack");
menuItem.setActionCommand(CMD_AUTO_ORDER_LAST);
menuItem.addActionListener(actionListener);
popupMenuTriggerOrder.add(menuItem);
menuItem = new JMenuItem("Put all abilities with that rule text always first on the stack");
menuItem.setActionCommand(CMD_AUTO_ORDER_NAME_FIRST);
menuItem.addActionListener(actionListener);
popupMenuTriggerOrder.add(menuItem);
menuItem = new JMenuItem("Put all abilities with that rule text always last on the stack");
menuItem.setActionCommand(CMD_AUTO_ORDER_NAME_LAST);
menuItem.addActionListener(actionListener);
popupMenuTriggerOrder.add(menuItem);
menuItem = new JMenuItem("Reset all order settings for triggered abilities");
menuItem.setActionCommand(CMD_AUTO_ORDER_RESET_ALL);
menuItem.addActionListener(actionListener);
popupMenuTriggerOrder.add(menuItem);
}
代码示例来源:origin: apache/pdfbox
findMenuItem.setActionCommand("find");
findMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, SHORCUT_KEY_MASK));
代码示例来源:origin: magefree/mage
menuItem.setActionCommand(CMD_AUTO_ANSWER_ID_YES);
menuItem.addActionListener(actionListener);
menuItem.setToolTipText("<HTML>If the same question from the same ability would<br/>be asked again, it's automatically answered with <b>Yes</b>.");
menuItem.setActionCommand(CMD_AUTO_ANSWER_ID_NO);
menuItem.setToolTipText("<HTML>If the same question from the same ability would<br/>be asked again, it's automatically answered with <b>No</b>.");
menuItem.addActionListener(actionListener);
menuItem.setActionCommand(CMD_AUTO_ANSWER_NAME_YES);
menuItem.setToolTipText("<HTML>If the same question would be asked again (regardless from which source),<br/> it's automatically answered with <b>Yes</b>.");
menuItem.addActionListener(actionListener);
menuItem.setActionCommand(CMD_AUTO_ANSWER_NAME_NO);
menuItem.setToolTipText("<HTML>If the same question would be asked again (regardless from which source),<br/> it's automatically answered with <b>No</b>.");
menuItem.addActionListener(actionListener);
menuItem.setActionCommand(CMD_AUTO_ANSWER_RESET_ALL);
menuItem.addActionListener(actionListener);
popupMenuAskYes.add(menuItem);
menuItem.setActionCommand(CMD_AUTO_ANSWER_RESET_ALL);
menuItem.addActionListener(actionListener);
popupMenuAskNo.add(menuItem);
代码示例来源:origin: bobbylight/RSyntaxTextArea
public SyntaxSchemeDemo() {
JPanel cp = new JPanel(new BorderLayout());
textArea = new RSyntaxTextArea(20, 60);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
textArea.setCodeFoldingEnabled(true);
textArea.setAntiAliasingEnabled(true);
RTextScrollPane sp = new RTextScrollPane(textArea);
cp.add(sp);
textArea.setText(TEXT);
JMenuBar mb = new JMenuBar();
JMenu menu = new JMenu("File");
mb.add(menu);
JMenuItem changeStyleProgrammaticallyItem = new JMenuItem(
"Change Style Programmatically");
changeStyleProgrammaticallyItem
.setActionCommand("ChangeProgrammatically");
changeStyleProgrammaticallyItem.addActionListener(this);
menu.add(changeStyleProgrammaticallyItem);
JMenuItem changeStyleViaThemesItem = new JMenuItem(
"Change Style via Theme XML");
changeStyleViaThemesItem.setActionCommand("ChangeViaThemes");
changeStyleViaThemesItem.addActionListener(this);
menu.add(changeStyleViaThemesItem);
setJMenuBar(mb);
setContentPane(cp);
setTitle("Syntax Scheme Demo");
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
}
代码示例来源:origin: magefree/mage
menuItem.setActionCommand("F2");
menuItem.setMnemonic(KeyEvent.VK_O);
popupMenu.add(menuItem);
menuItem.setActionCommand("F3");
menuItem.setMnemonic(KeyEvent.VK_N);
popupMenu.add(menuItem);
String everythingTooltipText = "<html>This skip actions stops if <b>attackers</b> or <b>blocker</b> have to be <b>declared</b>, but not if something goes to the <b>stack</b>.";
menuItem = new JMenuItem("<html><b>F4</b> - Phases until next turn");
menuItem.setActionCommand("F4");
menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_T);
menuItem.setActionCommand("F5");
menuItem.setToolTipText(tooltipText);
menuItem.setMnemonic(KeyEvent.VK_E);
menuItem.setActionCommand("F6");
menuItem.setToolTipText(everythingTooltipText);
menuItem.setMnemonic(KeyEvent.VK_U);
menuItem.setActionCommand("F7");
menuItem.setMnemonic(KeyEvent.VK_M);
skipMenu.add(menuItem);
menuItem.setActionCommand("F9");
menuItem.setToolTipText(everythingTooltipText);
menuItem.setMnemonic(KeyEvent.VK_V);
代码示例来源:origin: chatty/chatty
private JMenuItem makeCheckboxItem(String action, String text, boolean selected) {
JMenuItem item = new JCheckBoxMenuItem(text, selected);
item.setActionCommand(action);
item.addActionListener(listener);
return item;
}
代码示例来源:origin: net.imagej/imagej-ui-swing
private JMenuItem getAddParticlesMenuItem() {
final JMenuItem item;
item = new JMenuItem("Add Particles");
item.setActionCommand(ACTION_ADD_PARTICLES);
item.addActionListener(this);
return item;
}
代码示例来源:origin: net.imagej/imagej-ui-swing
private JMenuItem getSpecifyMenuItem() {
final JMenuItem item;
item = new JMenuItem("Specify...");
item.setActionCommand(ACTION_SPECIFY);
item.addActionListener(this);
return item;
}
代码示例来源:origin: net.imagej/ij-ui-swing
private JMenuItem getMultiPlotMenuItem() {
final JMenuItem item;
item = new JMenuItem("Multi Plot");
item.setActionCommand(ACTION_MULTI_PLOT);
item.addActionListener(this);
return item;
}
代码示例来源:origin: net.imagej/ij-ui-swing
private JMenuItem getSortMenuItem() {
final JMenuItem item;
item = new JMenuItem("Sort");
item.setActionCommand(ACTION_SORT);
item.addActionListener(this);
return item;
}
代码示例来源:origin: net.imagej/ij-ui-swing
private JMenuItem getDivideMenuItem() {
final JMenuItem item;
item = new JMenuItem("Divide");
item.setActionCommand(ACTION_DIVIDE);
item.addActionListener(this);
return item;
}
代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking
private JMenuItem createPopUpItem(String text, Icon icon, String tooltip, String actionCommand, KeyStroke accelerator) {
JMenuItem menuItem = new JMenuItem(text, icon);
menuItem.setActionCommand(actionCommand);
menuItem.addActionListener(actionListener);
if(accelerator != null) {
menuItem.setAccelerator(accelerator);
}
return menuItem;
}
代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking
private JMenuItem createPopUpItem(String text, Icon icon, String tooltip, String actionCommand, KeyStroke accelerator) {
JMenuItem menuItem = new JMenuItem(text, icon);
menuItem.setActionCommand(actionCommand);
menuItem.addActionListener(actionListener);
if(accelerator != null) {
menuItem.setAccelerator(accelerator);
}
return menuItem;
}
代码示例来源:origin: chatty/chatty
private JMenuItem makeRadioItem(String action, String text, String group) {
JMenuItem item = new JRadioButtonMenuItem(text);
item.setActionCommand(action);
item.addActionListener(listener);
if (!buttonGroups.containsKey(group)) {
buttonGroups.put(group, new ButtonGroup());
}
buttonGroups.get(group).add(item);
return item;
}
代码示例来源:origin: chatty/chatty
private JMenuItem makeItem(String action, String text, ImageIcon icon) {
JMenuItem item = new JMenuItem(text);
item.setActionCommand(action);
item.addActionListener(listener);
if (icon != null) {
item.setIcon(icon);
}
return item;
}
代码示例来源:origin: uk.ac.gate.plugins/tools
/**
* Sets the action commands of all menu items to the specified command
*/
private void setMenuCommands(JPopupMenu menu, String command) {
for (int i = 0; i < menu.getComponentCount() ; i++) {
JMenuItem item = (JMenuItem) menu.getComponent(i);
item.setActionCommand(command);
}
} // setMenuCommands
内容来源于网络,如有侵权,请联系作者删除!