本文整理了Java中javax.swing.JMenuItem.setMnemonic()
方法的一些代码示例,展示了JMenuItem.setMnemonic()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setMnemonic()
方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setMnemonic
暂无
代码示例来源:origin: log4j/log4j
protected JMenuItem createNoLogLevelsMenuItem() {
JMenuItem result = new JMenuItem("Hide all LogLevels");
result.setMnemonic('h');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAllLogLevels(false);
_table.getFilteredLogTableModel().refresh();
updateStatusLabel();
}
});
return result;
}
代码示例来源:origin: libgdx/libgdx
fileMenu.setMnemonic(KeyEvent.VK_F);
openMenuItem = new JMenuItem("Open Hiero settings file...");
openMenuItem.setMnemonic(KeyEvent.VK_O);
openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK));
fileMenu.add(openMenuItem);
saveMenuItem = new JMenuItem("Save Hiero settings file...");
saveMenuItem.setMnemonic(KeyEvent.VK_S);
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK));
fileMenu.add(saveMenuItem);
saveBMFontMenuItem = new JMenuItem("Save BMFont files (text)...");
saveBMFontMenuItem.setMnemonic(KeyEvent.VK_B);
saveBMFontMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK));
fileMenu.add(saveBMFontMenuItem);
exitMenuItem = new JMenuItem("Exit");
exitMenuItem.setMnemonic(KeyEvent.VK_X);
fileMenu.add(exitMenuItem);
代码示例来源:origin: log4j/log4j
protected JMenuItem createConfigureMaxRecords() {
JMenuItem result = new JMenuItem("Set Max Number of Records");
result.setMnemonic('m');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setMaxRecordConfiguration();
}
});
return result;
}
代码示例来源:origin: libgdx/libgdx
fileMenu.setMnemonic(KeyEvent.VK_F);
openMenuItem = new JMenuItem("Open Hiero settings file...");
openMenuItem.setMnemonic(KeyEvent.VK_O);
openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK));
fileMenu.add(openMenuItem);
saveMenuItem = new JMenuItem("Save Hiero settings file...");
saveMenuItem.setMnemonic(KeyEvent.VK_S);
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK));
fileMenu.add(saveMenuItem);
saveBMFontMenuItem = new JMenuItem("Save BMFont files (text)...");
saveBMFontMenuItem.setMnemonic(KeyEvent.VK_B);
saveBMFontMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK));
fileMenu.add(saveBMFontMenuItem);
exitMenuItem = new JMenuItem("Exit");
exitMenuItem.setMnemonic(KeyEvent.VK_X);
fileMenu.add(exitMenuItem);
代码示例来源:origin: log4j/log4j
protected JMenuItem createConfigureReset() {
JMenuItem result = new JMenuItem("Reset");
result.setMnemonic('r');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
resetConfiguration();
}
});
return result;
}
代码示例来源:origin: ron190/jsql-injection
public JPopupMenuTable(JTable tableValues, Action actionShowSearchTable) {
this(tableValues);
this.addSeparator();
JMenuItem search = new JMenuItem();
search.setAction(actionShowSearchTable);
search.setText("Search...");
search.setMnemonic('S');
search.setIcon(HelperUi.ICON_EMPTY);
search.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK));
this.add(search);
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createConfigureSave() {
JMenuItem result = new JMenuItem("Save");
result.setMnemonic('s');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveConfiguration();
}
});
return result;
}
代码示例来源:origin: ron190/jsql-injection
/**
* Create popup menu for this component.
* @param component The component receiving the menu
*/
public JPopupMenuText(JTextComponent component) {
super(component);
if (component.isEditable()) {
JMenuItem cutItem = new JMenuItem();
cutItem.setIcon(HelperUi.ICON_EMPTY);
cutItem.setAction(component.getActionMap().get(DefaultEditorKit.cutAction));
cutItem.setText("Cut");
cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
cutItem.setMnemonic('t');
JMenuItem pasteItem = new JMenuItem();
pasteItem.setIcon(HelperUi.ICON_EMPTY);
pasteItem.setAction(component.getActionMap().get(DefaultEditorKit.pasteAction));
pasteItem.setText("Paste");
pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
pasteItem.setMnemonic('P');
// Before Copy menu
this.add(cutItem, 0);
// After Copy menu
this.add(pasteItem, 2);
}
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createAllLogLevelsMenuItem() {
JMenuItem result = new JMenuItem("Show all LogLevels");
result.setMnemonic('s');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAllLogLevels(true);
_table.getFilteredLogTableModel().refresh();
updateStatusLabel();
}
});
return result;
}
代码示例来源:origin: ron190/jsql-injection
JMenuItem copyItem = new JMenuItem();
copyItem.setAction(new ActionCopy());
copyItem.setText(I18n.valueByKey("CONTEXT_MENU_COPY"));
I18nView.addComponentForKey("CONTEXT_MENU_COPY", copyItem);
copyItem.setMnemonic('C');
copyItem.setIcon(HelperUi.ICON_EMPTY);
copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
JMenuItem selectAllItem = new JMenuItem();
selectAllItem.setAction(new ActionSelectAll());
selectAllItem.setText(I18n.valueByKey("CONTEXT_MENU_SELECT_ALL"));
I18nView.addComponentForKey("CONTEXT_MENU_SELECT_ALL", selectAllItem);
selectAllItem.setMnemonic('A');
selectAllItem.setIcon(HelperUi.ICON_EMPTY);
selectAllItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
代码示例来源:origin: log4j/log4j
protected JMenuItem createExitMI() {
JMenuItem result = new JMenuItem("Exit");
result.setMnemonic('x');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestExit();
}
});
return result;
}
代码示例来源:origin: ron190/jsql-injection
this.component = component;
JMenuItem copyItem = new JMenuItem();
copyItem.setAction(component.getActionMap().get(DefaultEditorKit.copyAction));
copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
copyItem.setMnemonic('C');
copyItem.setText(I18n.valueByKey("CONTEXT_MENU_COPY"));
I18nView.addComponentForKey("CONTEXT_MENU_COPY", copyItem);
this.setLightWeightPopupEnabled(false);
JMenuItem selectAllItem = new JMenuItem();
selectAllItem.setIcon(HelperUi.ICON_EMPTY);
selectAllItem.setAction(component.getActionMap().get(DefaultEditorKit.selectAllAction));
I18nView.addComponentForKey("CONTEXT_MENU_SELECT_ALL", selectAllItem);
selectAllItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
selectAllItem.setMnemonic('A');
|| component instanceof JTextPanePlaceholderConsole
) {
JMenuItem clearItem = new JMenuItem();
clearItem.setIcon(HelperUi.ICON_EMPTY);
clearItem.setAction(new AbstractAction() {
I18nView.addComponentForKey("CONTEXT_MENU_CLEAR", clearItem);
clearItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
clearItem.setMnemonic('E');
代码示例来源:origin: log4j/log4j
protected JMenuItem createHelpProperties() {
final String title = "LogFactor5 Properties";
final JMenuItem result = new JMenuItem(title);
result.setMnemonic('l');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
showPropertiesDialog(title);
}
});
return result;
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createResetLogLevelColorMenuItem() {
JMenuItem result = new JMenuItem("Reset LogLevel Colors");
result.setMnemonic('r');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// reset the level colors in the map
LogLevel.resetLogLevelColorMap();
// refresh the table
_table.getFilteredLogTableModel().refresh();
}
});
return result;
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createAllLogTableColumnsMenuItem() {
JMenuItem result = new JMenuItem("Show all Columns");
result.setMnemonic('s');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAllLogTableColumns(true);
// update list of columns and reset the view
List selectedColumns = updateView();
_table.setView(selectedColumns);
}
});
return result;
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createNoLogTableColumnsMenuItem() {
JMenuItem result = new JMenuItem("Hide all Columns");
result.setMnemonic('h');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAllLogTableColumns(false);
// update list of columns and reset the view
List selectedColumns = updateView();
_table.setView(selectedColumns);
}
});
return result;
}
代码示例来源:origin: log4j/log4j
/**
* Menu item added to allow log files to be opened with
* the LF5 GUI.
*/
protected JMenuItem createOpenMI() {
JMenuItem result = new JMenuItem("Open...");
result.setMnemonic('o');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestOpen();
}
});
return result;
}
代码示例来源:origin: log4j/log4j
/**
* Menu item added to allow log files loaded from a URL
* to be opened by the LF5 GUI.
*/
protected JMenuItem createOpenURLMI() {
JMenuItem result = new JMenuItem("Open URL...");
result.setMnemonic('u');
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestOpenURL();
}
});
return result;
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createEditFindNextMI() {
JMenuItem editFindNextMI = new JMenuItem("Find Next");
editFindNextMI.setMnemonic('n');
editFindNextMI.setAccelerator(KeyStroke.getKeyStroke("F3"));
editFindNextMI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
findSearchText();
}
});
return editFindNextMI;
}
代码示例来源:origin: log4j/log4j
protected JMenuItem createCloseMI() {
JMenuItem result = new JMenuItem("Close");
result.setMnemonic('c');
result.setAccelerator(KeyStroke.getKeyStroke("control Q"));
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestClose();
}
});
return result;
}
内容来源于网络,如有侵权,请联系作者删除!