本文整理汇总了Java中javax.swing.JMenu.setMnemonic方法的典型用法代码示例。如果您正苦于以下问题:Java JMenu.setMnemonic方法的具体用法?Java JMenu.setMnemonic怎么用?Java JMenu.setMnemonic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenu
的用法示例。
在下文中一共展示了JMenu.setMnemonic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PopuleBarra
import javax.swing.JMenu; //导入方法依赖的package包/类
public void PopuleBarra(JMenu obj) {
int i = 0;
for (ConfigAcao ca : Lista) {
if (ca.tipo == TipoConfigAcao.tpMenuBarra || ca.tipo == TipoConfigAcao.tpAny) {
Acao ac = new Acao(editor, ca.texto, ca.ico, ca.descricao, ca.command);
ac.IDX = i++;
JMenuItem mi = new JMenuItem(ac);
//obj.add(mi);
listaMenus.put(ca.command, mi);
//ListaDeAcoes.add(ac);
}
}
obj.setText(Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.texto"));
char b = Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.mtecla").charAt(0);
obj.setMnemonic(b);
BarraMenu = obj;
}
示例2: getWorkloadMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
private void getWorkloadMenubar(String mode) {
JMenuBar workloadMenubar = new JMenuBar();
JMenuItem[][] menuItems = {
{ new JMenuItem(WL_FILE_NEW), new JMenuItem(WL_FILE_OPEN), new JMenuItem(WL_FILE_SAVE), null, new JMenuItem(WL_EXIT_ACTION) },
{ new JMenuItem(WL_ACTION_SOLVE) }, { new JMenuItem(WL_HELP_SHOWHELP), null, new JMenuItem(WL_HELP_CREDITS) } };
String[] menuTitles = { "File", "Action", "Help" };
char[] chars = { 'F', 'A', 'e' };
for (int i = 0; i < menuItems.length; i++) {
JMenu menu = new JMenu(menuTitles[i]);
menu.setMnemonic(chars[i]);
for (int j = 0; j < menuItems[i].length; j++) {
if (menuItems[i][j] == null) {
menu.addSeparator();
} else {
menu.add(menuItems[i][j]);
if ((i == 0 && ((j == 0 && mode.equals("demo")) || j == 1 || j == 2)) || (i == 1 && j == 0)) {
menuItems[i][j].setEnabled(false);
}
}
}
workloadMenubar.add(menu);
}
setMenuBar(workloadMenubar);
}
示例3: getTrafficMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
private void getTrafficMenubar() {
JMenuBar jmb = new JMenuBar();
JMenuItem[][] menuItems = { { new JMenuItem(TR_FILE_NEW), null, new JMenuItem(TR_FILE_EXIT) },
{ new JMenuItem(TR_HELP), null, new JMenuItem(TR_ABOUT) } };
String[] menuTitles = { "File", "Help" };
char[] chars = { 'F', 'e' };
for (int i = 0; i < menuItems.length; i++) {
JMenu menu = new JMenu(menuTitles[i]);
menu.setMnemonic(chars[i]);
for (int j = 0; j < menuItems[i].length; j++) {
if (menuItems[i][j] == null) {
menu.addSeparator();
} else {
menu.add(menuItems[i][j]);
}
}
jmb.add(menu);
}
setMenuBar(jmb);
}
示例4: createFileMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void createFileMenu() {
fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
fileMenu.getAccessibleContext().setAccessibleDescription(
"Load configs or close the app.");
menuBar.add(fileMenu);
loadProblemItem = new JMenuItem("Load problem");
loadProblemItem.setMnemonic(KeyEvent.VK_P);
loadProblemItem.addActionListener(menuListener);
fileMenu.add(loadProblemItem);
loadSolutionItem = new JMenuItem("Load solution");
loadSolutionItem.setMnemonic(KeyEvent.VK_S);
loadSolutionItem.addActionListener(menuListener);
loadSolutionItem.setEnabled(false);
fileMenu.add(loadSolutionItem);
fileMenu.addSeparator();
exitItem = new JMenuItem("Exit");
exitItem.setMnemonic(KeyEvent.VK_X);
exitItem.addActionListener(menuListener);
fileMenu.add(exitItem);
}
示例5: createDisplayMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void createDisplayMenu() {
displayMenu = new JMenu("Display");
displayMenu.setMnemonic(KeyEvent.VK_D);
fileMenu.getAccessibleContext().setAccessibleDescription(
"Display the problem and solution.");
menuBar.add(displayMenu);
problemItem = new JMenuItem("Problem");
problemItem.setMnemonic(KeyEvent.VK_P);
problemItem.addActionListener(menuListener);
problemItem.setEnabled(false);
displayMenu.add(problemItem);
solutionItem = new JMenuItem("Solution");
solutionItem.setMnemonic(KeyEvent.VK_S);
solutionItem.addActionListener(menuListener);
solutionItem.setEnabled(false);
displayMenu.add(solutionItem);
}
示例6: makeMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Creates workload analysis menu
* @return menu
*/
public void makeMenubar() {
workloadMenubar = new JMenuBar();
JMenuItem[][] menuItems = { { new JMenuItem(HELP_CREDITS) } };
String[] menuTitles = { "Help" };
char[] chars = { 'e' };
for (int i = 0; i < menuItems.length; i++) {
JMenu menu = new JMenu(menuTitles[i]);
menu.setMnemonic(chars[i]);
for (int j = 0; j < menuItems[i].length; j++) {
if (menuItems[i][j] == null) {
menu.addSeparator();
} else {
menu.add(menuItems[i][j]);
}
}
workloadMenubar.add(menu);
}
parent.setMenuBar(workloadMenubar);
}
示例7: createToolsMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private JMenu createToolsMenu() {
JMenu tools = new JMenu("Tools");
tools.setMnemonic('T');
tools.add(
withMnemonics(
withShortCut(
withIcon(
Utils.createMenuItem("Exploratory", sActionListener))), 'E'));
JMenu optionsMenu = new JMenu("BDD");
optionsMenu.add(Utils.createMenuItem("Import Feature File", sActionListener));
optionsMenu.add(Utils.createMenuItem("Open Feature Editor", sActionListener));
tools.add(optionsMenu);
tools.add(
withMnemonics(
withShortCut(
Utils.createMenuItem("Har Compare", sActionListener)), 'H'));
return tools;
}
示例8: buildReportMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void buildReportMenu() {
// --> Report
JMenu menu = Utility.localizedMenu("menuBar.report");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_R);
menu.add(getMenuItem(ReportReligionAction.id));
menu.add(getMenuItem(ReportLabourAction.id));
menu.add(getMenuItem(ReportColonyAction.id));
menu.add(getMenuItem(ReportForeignAction.id));
menu.add(getMenuItem(ReportIndianAction.id));
menu.add(getMenuItem(ReportContinentalCongressAction.id));
menu.add(getMenuItem(ReportMilitaryAction.id));
menu.add(getMenuItem(ReportNavalAction.id));
menu.add(getMenuItem(ReportTradeAction.id));
menu.add(getMenuItem(ReportTurnAction.id));
menu.add(getMenuItem(ReportRequirementsAction.id));
menu.add(getMenuItem(ReportCargoAction.id));
menu.add(getMenuItem(ReportExplorationAction.id));
menu.add(getMenuItem(ReportHistoryAction.id));
menu.add(getMenuItem(ReportProductionAction.id));
menu.add(getMenuItem(ReportEducationAction.id));
menu.add(getMenuItem(ShowDifficultyAction.id));
menu.add(getMenuItem(ShowGameOptionsAction.id));
menu.add(getMenuItem(ShowMapGeneratorOptionsAction.id));
add(menu);
}
示例9: buildColopediaMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
protected void buildColopediaMenu() {
// --> Colopedia
JMenu menu = Utility.localizedMenu("menuBar.colopedia");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_C);
for (PanelType type : PanelType.values()) {
menu.add(getMenuItem(ColopediaAction.id + type.getKey()));
}
menu.addSeparator();
menu.add(getMenuItem(AboutAction.id));
add(menu);
}
示例10: buildGameMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void buildGameMenu() {
// --> Game
JMenu menu = Utility.localizedMenu("menuBar.game");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_G);
menu.add(getMenuItem(NewAction.id));
menu.add(getMenuItem(OpenAction.id));
menu.add(getMenuItem(SaveAction.id));
menu.addSeparator();
menu.add(getMenuItem(PreferencesAction.id));
menu.add(getMenuItem(ReconnectAction.id));
menu.addSeparator();
menu.add(getMenuItem(ChatAction.id));
menu.add(getMenuItem(DeclareIndependenceAction.id));
menu.add(getMenuItem(EndTurnAction.id));
menu.addSeparator();
menu.add(getMenuItem(ShowMainAction.id));
menu.add(getMenuItem(ReportHighScoresAction.id));
menu.add(getMenuItem(RetireAction.id));
menu.add(getMenuItem(SaveAndQuitAction.id));
menu.add(getMenuItem(QuitAction.id));
add(menu);
}
示例11: createObjectMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private JMenu createObjectMenu() {
JMenu object = new JMenu("Automation");
object.setMnemonic('A');
object.add(withMnemonics(
withShortCut(
withIcon(
Utils.createMenuItem("Object Spy", sActionListener))), 'S'));
object.add(withMnemonics(
withShortCut(
withIcon(
Utils.createMenuItem("Object Heal", sActionListener))), 'H'));
object.addSeparator();
object.add(withMnemonics(
withShortCut(
withIcon(
Utils.createMenuItem("Image Spy", sActionListener))), 'I'));
object.add(withMnemonics(
withShortCut(
withIcon(
Utils.createMenuItem("Mobile Spy", sActionListener))), 'M'));
object.addSeparator();
object.add(
withMnemonics(
withIcon(
Utils.createMenuItem("Inject Script", sActionListener)), 'n'));
object.add(
withMnemonics(Utils.createMenuItem("Create CM Project", sActionListener), 'C'));
return object;
}
示例12: initializeMenus
import javax.swing.JMenu; //导入方法依赖的package包/类
private void initializeMenus () {
{
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
{
JMenu fileMenu = new JMenu();
menuBar.add(fileMenu);
fileMenu.setText("File");
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);
}
fileMenu.addSeparator();
{
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);
}
fileMenu.addSeparator();
{
exitMenuItem = new JMenuItem("Exit");
exitMenuItem.setMnemonic(KeyEvent.VK_X);
fileMenu.add(exitMenuItem);
}
}
}
}
示例13: createTestDataMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private JMenu createTestDataMenu() {
JMenu testData = new JMenu("Test Data");
testData.setMnemonic('D');
testData.add(withMnemonics(
Utils.createMenuItem("Import TestData", sActionListener), 'I'));
multiEnv = withMnemonics(
new JCheckBoxMenuItem("Multiple Environment"), 'M');
multiEnv.addActionListener(sActionListener);
testData.add(multiEnv);
return testData;
}
示例14: createHelpMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Creates and returns a help menu for the menu bar.
*/
private JMenu createHelpMenu() {
JMenu result = new JMenu(HELP_MENU_NAME);
result.setMnemonic(Options.HELP_MENU_MNEMONIC);
result.add(new JMenuItem(new AboutAction(getFrame())));
return result;
}
示例15: getTrafficMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
private void getTrafficMenubar() {
JMenuBar jmb = new JMenuBar();
/*JMenuItem[][] menuItems = {{new JMenuItem(FILE_NEW),null, new JMenuItem(FILE_EXIT)},
{new JMenuItem(ACTION_SOLVE),
null, new JMenuItem(ACTION_NEXT), new JMenuItem(ACTION_PREV)},
{new JMenuItem(HELP), null, new JMenuItem(ABOUT)} };*/
JMenuItem[][] menuItems = { { new JMenuItem(TR_FILE_NEW), null, new JMenuItem(TR_FILE_EXIT) },
{ new JMenuItem(ACTION_NEXT), new JMenuItem(ACTION_PREV) }, { new JMenuItem(TR_HELP), null, new JMenuItem(TR_ABOUT) } };
String[] menuTitles = { "File", "Action", "Help" };
char[] chars = { 'F', 'A', 'e' };
for (int i = 0; i < menuItems.length; i++) {
JMenu menu = new JMenu(menuTitles[i]);
menu.setMnemonic(chars[i]);
for (int j = 0; j < menuItems[i].length; j++) {
if (menuItems[i][j] == null) {
menu.addSeparator();
} else {
menu.add(menuItems[i][j]);
}
}
jmb.add(menu);
}
setMenuBar(jmb);
}