本文整理了Java中javax.swing.JMenu.<init>()
方法的一些代码示例,展示了JMenu.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.<init>()
方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:<init>
暂无
代码示例来源:origin: log4j/log4j
protected JMenu createHelpMenu() {
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic('h');
helpMenu.add(createHelpProperties());
return helpMenu;
}
代码示例来源:origin: kevin-wayne/algs4
private static JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem1 = new JMenuItem(" Save... ");
menuItem1.addActionListener(std);
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menu.add(menuItem1);
return menuBar;
}
代码示例来源:origin: log4j/log4j
protected JMenu createViewMenu() {
JMenu result = new JMenu("View");
result.setMnemonic('v');
Iterator columns = getLogTableColumns();
while (columns.hasNext()) {
result.add(getLogTableColumnMenuItem((LogTableColumn) columns.next()));
}
result.addSeparator();
result.add(createAllLogTableColumnsMenuItem());
result.add(createNoLogTableColumnsMenuItem());
return result;
}
代码示例来源:origin: deathmarine/Luyten
private void buildHelpMenu(JMenu helpMenu) {
helpMenu.removeAll();
JMenuItem menuItem = new JMenuItem("Legal");
menuItem.addActionListener(new ActionListener() {
@Override
helpMenu.add(menuItem);
JMenu menuDebug = new JMenu("Debug");
menuItem = new JMenuItem("List JVM Classes");
menuItem.addActionListener(new ActionListener() {
@Override
menuDebug.add(menuItem);
helpMenu.add(menuDebug);
menuItem = new JMenuItem("About");
menuItem.addActionListener(new ActionListener() {
@Override
代码示例来源:origin: skylot/jadx
exportAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK));
JMenu recentFiles = new JMenu(NLS.str("menu.recent_files"));
recentFiles.addMenuListener(new RecentFilesMenuListener(recentFiles));
KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
JMenu file = new JMenu(NLS.str("menu.file"));
file.setMnemonic(KeyEvent.VK_F);
file.add(openAction);
file.add(saveAllAction);
file.add(exportAction);
JMenu view = new JMenu(NLS.str("menu.view"));
JMenu nav = new JMenu(NLS.str("menu.navigation"));
JMenu tools = new JMenu(NLS.str("menu.tools"));
JMenu help = new JMenu(NLS.str("menu.help"));
JMenuBar menuBar = new JMenuBar();
menuBar.add(file);
menuBar.add(view);
menuBar.add(nav);
代码示例来源:origin: deathmarine/Luyten
private void buildFileMenu(final JMenu fileMenu) {
fileMenu.removeAll();
JMenuItem menuItem = new JMenuItem("Open File...");
menuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
fileMenu.add(menuItem);
fileMenu.addSeparator();
menuItem = new JMenuItem("Close File");
menuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
fileMenu.add(menuItem);
fileMenu.addSeparator();
menuItem = new JMenuItem("Save As...");
menuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
fileMenu.add(menuItem);
menuItem = new JMenuItem("Save All...");
fileMenu.addSeparator();
recentFiles = new JMenu("Recent Files");
fileMenu.add(recentFiles);
代码示例来源:origin: 4thline/cling
menuItem = new JMenu(entry.getKey().getDetails().getFriendlyName());
for (int i = 0; i < SUPPORTED_INSTANCES; i++) {
final int instanceId = i;
JMenuItem instanceItem = new JMenuItem("Instance: " + i);
instanceItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
menuItem = new JMenuItem(
entry.getKey().getDetails().getFriendlyName() + " (Not Compatible)"
);
JMenuItem noRenderersItem = new JMenuItem("No MediaRenderers found...");
noRenderersItem.setEnabled(false);
menuItems.add(noRenderersItem);
代码示例来源:origin: apache/tika
private void addMenuBar() {
JMenuBar bar = new JMenuBar();
JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O);
addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U);
file.addSeparator();
addMenuItem(file, "Exit", "exit", KeyEvent.VK_X);
bar.add(file);
JMenu view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M);
addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F);
addMenuItem(view, "Plain text", "text", KeyEvent.VK_P);
addMenuItem(view, "Main content", "main", KeyEvent.VK_C);
addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S);
addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J);
bar.add(view);
bar.add(Box.createHorizontalGlue());
JMenu help = new JMenu("Help");
help.setMnemonic(KeyEvent.VK_H);
addMenuItem(help, "About Tika", "about", KeyEvent.VK_A);
bar.add(help);
setJMenuBar(bar);
}
代码示例来源:origin: kevin-wayne/algs4
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem1 = new JMenuItem(" Save... ");
menuItem1.addActionListener(this);
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menu.add(menuItem1);
return menuBar;
}
代码示例来源:origin: deathmarine/Luyten
luytenPrefs = configSaver.getLuytenPreferences();
final JMenu fileMenu = new JMenu("File");
fileMenu.add(new JMenuItem("..."));
this.add(fileMenu);
final JMenu editMenu = new JMenu("Edit");
editMenu.add(new JMenuItem("..."));
this.add(editMenu);
final JMenu themesMenu = new JMenu("Themes");
themesMenu.add(new JMenuItem("..."));
this.add(themesMenu);
final JMenu operationMenu = new JMenu("Operation");
operationMenu.add(new JMenuItem("..."));
this.add(operationMenu);
final JMenu settingsMenu = new JMenu("Settings");
settingsMenu.add(new JMenuItem("..."));
this.add(settingsMenu);
final JMenu helpMenu = new JMenu("Help");
helpMenu.add(new JMenuItem("..."));
this.add(helpMenu);
代码示例来源:origin: log4j/log4j
protected JMenu createEditMenu() {
JMenu editMenu = new JMenu("Edit");
editMenu.setMnemonic('e');
editMenu.add(createEditFindMI());
editMenu.add(createEditFindNextMI());
editMenu.addSeparator();
editMenu.add(createEditSortNDCMI());
editMenu.add(createEditRestoreAllNDCMI());
return editMenu;
}
代码示例来源:origin: apache/pdfbox
private JMenu createEditMenu()
{
JMenu editMenu = new JMenu("Edit");
editMenu.setMnemonic('E');
JMenuItem cutMenuItem = new JMenuItem("Cut");
cutMenuItem.setEnabled(false);
editMenu.add(cutMenuItem);
JMenuItem copyMenuItem = new JMenuItem("Copy");
copyMenuItem.setEnabled(false);
editMenu.add(copyMenuItem);
JMenuItem pasteMenuItem = new JMenuItem("Paste");
pasteMenuItem.setEnabled(false);
editMenu.add(pasteMenuItem);
JMenuItem deleteMenuItem = new JMenuItem("Delete");
deleteMenuItem.setEnabled(false);
editMenu.add(deleteMenuItem);
editMenu.addSeparator();
editMenu.add(createFindMenu());
return editMenu;
}
代码示例来源:origin: log4j/log4j
protected JMenu createLogLevelColorMenu() {
JMenu colorMenu = new JMenu("Configure LogLevel Colors");
colorMenu.setMnemonic('c');
Iterator levels = getLogLevels();
while (levels.hasNext()) {
colorMenu.add(createSubMenuItem((LogLevel) levels.next()));
}
return colorMenu;
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents () {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem = new JMenuItem("Open");
menuItem.addActionListener(new ActionListener() {
menu.add(menuItem);
menuItem = new JMenuItem("Save");
menuItem.addActionListener(new ActionListener() {
menu.add(menuItem);
setJMenuBar(menuBar);
代码示例来源:origin: wiztools/rest-client
JMenu jm_format = new JMenu("Format");
JMenuItem jmi_fmt_xml = new JMenuItem("XML");
jmi_fmt_xml.addActionListener((ActionEvent e) -> {
final String unformatted = se.getText();
job.run(r, listener, isSeparateThread);
});
jm_format.add(jmi_fmt_xml);
JMenuItem jmi_fmt_json = new JMenuItem("JSON");
jmi_fmt_json.addActionListener((ActionEvent e) -> {
final String unformatted = se.getText();
job.run(r, listener, isSeparateThread);
});
jm_format.add(jmi_fmt_json);
JMenuItem jmi_fmt_html = new JMenuItem("HTML");
jmi_fmt_html.addActionListener((ActionEvent e) -> {
final String unformatted = se.getText();
job.run(r, listener, isSeparateThread);
});
jm_format.add(jmi_fmt_html);
JMenu jm_syntax = new JMenu("Syntax Color");
代码示例来源:origin: log4j/log4j
protected JMenu createFileMenu() {
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic('f');
JMenuItem exitMI;
fileMenu.add(createOpenMI());
fileMenu.add(createOpenURLMI());
fileMenu.addSeparator();
fileMenu.add(createCloseMI());
createMRUFileListMI(fileMenu);
fileMenu.addSeparator();
fileMenu.add(createExitMI());
return fileMenu;
}
代码示例来源:origin: log4j/log4j
protected JMenu createConfigureMenu() {
JMenu configureMenu = new JMenu("Configure");
configureMenu.setMnemonic('c');
configureMenu.add(createConfigureSave());
configureMenu.add(createConfigureReset());
configureMenu.add(createConfigureMaxRecords());
return configureMenu;
}
代码示例来源:origin: libgdx/libgdx
private void initializeComponents () {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem = new JMenuItem("Open");
menuItem.addActionListener(new ActionListener() {
menu.add(menuItem);
menuItem = new JMenuItem("Save");
menuItem.addActionListener(new ActionListener() {
menu.add(menuItem);
setJMenuBar(menuBar);
代码示例来源:origin: apache/pdfbox
private JMenu createFindMenu()
findMenu = new JMenu("Find");
findMenu.setEnabled(false);
findMenuItem = new JMenuItem("Find...");
findMenuItem.setActionCommand("find");
findMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, SHORCUT_KEY_MASK));
findNextMenuItem = new JMenuItem("Find Next");
if (IS_MAC_OS)
findPreviousMenuItem = new JMenuItem("Find Previous");
if (IS_MAC_OS)
findMenu.add(findMenuItem);
findMenu.add(findNextMenuItem);
findMenu.add(findPreviousMenuItem);
代码示例来源:origin: log4j/log4j
protected JMenu createLogLevelMenu() {
JMenu result = new JMenu("Log Level");
result.setMnemonic('l');
Iterator levels = getLogLevels();
while (levels.hasNext()) {
result.add(getMenuItem((LogLevel) levels.next()));
}
result.addSeparator();
result.add(createAllLogLevelsMenuItem());
result.add(createNoLogLevelsMenuItem());
result.addSeparator();
result.add(createLogLevelColorMenu());
result.add(createResetLogLevelColorMenuItem());
return result;
}
内容来源于网络,如有侵权,请联系作者删除!