本文整理了Java中javax.swing.JMenu.addSeparator()
方法的一些代码示例,展示了JMenu.addSeparator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenu.addSeparator()
方法的具体详情如下:
包路径:javax.swing.JMenu
类名称:JMenu
方法名:addSeparator
暂无
代码示例来源: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: log4j/log4j
/**
* Creates a Most Recently Used file list to be
* displayed in the File menu
*/
protected void createMRUFileListMI(JMenu menu) {
String[] files = _mruFileManager.getMRUFileList();
if (files != null) {
menu.addSeparator();
for (int i = 0; i < files.length; i++) {
JMenuItem result = new JMenuItem((i + 1) + " " + files[i]);
result.setMnemonic(i + 1);
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestOpenMRU(e);
}
});
menu.add(result);
}
}
}
代码示例来源:origin: log4j/log4j
/**
* Removes old file list and creates a new file list
* with the updated MRU list.
*/
protected void updateMRUList() {
JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0);
menu.removeAll();
menu.add(createOpenMI());
menu.add(createOpenURLMI());
menu.addSeparator();
menu.add(createCloseMI());
createMRUFileListMI(menu);
menu.addSeparator();
menu.add(createExitMI());
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Creates a Most Recently Used file list to be
* displayed in the File menu
*/
protected void createMRUFileListMI(JMenu menu) {
String[] files = _mruFileManager.getMRUFileList();
if (files != null) {
menu.addSeparator();
for (int i = 0; i < files.length; i++) {
JMenuItem result = new JMenuItem((i + 1) + " " + files[i]);
result.setMnemonic(i + 1);
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestOpenMRU(e);
}
});
menu.add(result);
}
}
}
代码示例来源:origin: protegeproject/protege
/**
* Installs the help menu for non-OS-X systems
* @param helpMenu The help menu. Not {@code null}.
*/
private void installHelpMenu(JMenu helpMenu) {
if (OSUtils.isOSX()) {
return;
}
helpMenu.addSeparator();
JMenuItem aboutMenuItem = helpMenu.add("About");
aboutMenuItem.addActionListener(e -> AboutPanel.showDialog());
}
代码示例来源: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: org.gosu-lang.gosu/gosu-lab
private void makeBuildMenu( JMenuBar menuBar )
{
JMenu buildMenu = new SmartMenu( "Build" );
buildMenu.setMnemonic( 'b' );
menuBar.add( buildMenu );
JMenuItem make = new SmartMenuItem( new CommonMenus.MakeActionHandler() );
make.setMnemonic( 'm' );
make.setAccelerator( KeyStroke.getKeyStroke( EditorUtilities.CONTROL_KEY_NAME + " F9" ) );
buildMenu.add( make );
JMenuItem rebuild = new SmartMenuItem( new CommonMenus.RebuildActionHandler() );
rebuild.setMnemonic( 'b' );
buildMenu.add( rebuild );
buildMenu.addSeparator();
JMenuItem shipIt = new SmartMenuItem( new CommonMenus.ShipItActionHandler() );
shipIt.setMnemonic( 'p' );
shipIt.setAccelerator( KeyStroke.getKeyStroke( EditorUtilities.CONTROL_KEY_NAME + " F10" ) );
buildMenu.add( shipIt );
}
代码示例来源:origin: haraldk/TwelveMonkeys
private JPopupMenu createPopupMenu() {
JPopupMenu popup = new JPopupMenu();
popup.add(getActionMap().get(ZOOM_ACTUAL));
popup.add(getActionMap().get(ZOOM_IN));
popup.add(getActionMap().get(ZOOM_OUT));
popup.addSeparator();
ButtonGroup group = new ButtonGroup();
JMenu background = new JMenu("Background");
popup.add(background);
ChangeBackgroundAction checkered = new ChangeBackgroundAction("Checkered", checkeredBG);
checkered.putValue(Action.SELECTED_KEY, backgroundPaint == checkeredBG);
addCheckBoxItem(checkered, background, group);
background.addSeparator();
addCheckBoxItem(new ChangeBackgroundAction("White", Color.WHITE), background, group);
addCheckBoxItem(new ChangeBackgroundAction("Light", Color.LIGHT_GRAY), background, group);
addCheckBoxItem(new ChangeBackgroundAction("Gray", Color.GRAY), background, group);
addCheckBoxItem(new ChangeBackgroundAction("Dark", Color.DARK_GRAY), background, group);
addCheckBoxItem(new ChangeBackgroundAction("Black", Color.BLACK), background, group);
background.addSeparator();
ChooseBackgroundAction chooseBackgroundAction = new ChooseBackgroundAction("Choose...", defaultBG != null ? defaultBG : Color.BLUE);
chooseBackgroundAction.putValue(Action.SELECTED_KEY, backgroundPaint == defaultBG);
addCheckBoxItem(chooseBackgroundAction, background, group);
return popup;
}
代码示例来源:origin: libgdx/libgdx
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");
代码示例来源: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: Audiveris/audiveris
/**
* Insert a pseudo-item, to be used as a menu title.
*
* @param menu the containing menu
* @param text the title text
*/
public static void insertTitle (JMenu menu,
String text)
{
JMenuItem title = new JMenuItem(text);
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setEnabled(false);
menu.add(title);
menu.addSeparator();
}
代码示例来源:origin: protegeproject/protege
/**
* Installs the file menu for non-OS-X systems.
* @param fileMenu The file menu. Not {@code null}.
*/
private void installFileMenu(JMenu fileMenu) {
if (OSUtils.isOSX()) {
return;
}
fileMenu.addSeparator();
JMenuItem prefsMenuItem = fileMenu.add("Preferences...");
prefsMenuItem.addActionListener(e -> PreferencesDialogPanel.showPreferencesDialog(null, getEditorKit()));
prefsMenuItem.setAccelerator(KeyStroke.getKeyStroke(","));
fileMenu.addSeparator();
JMenuItem exitMenuItem = fileMenu.add("Exit");
exitMenuItem.addActionListener(e -> ProtegeApplication.handleQuit());
}
代码示例来源:origin: org.appdapter/org.appdapter.lib.gui
/**
Creates the file menu and adds its individual menu items.
Note the each menu item is registered with an ActionListener.
*/
private JMenu initFileMenu() {
JMenu fileMenu = new JMenu("File"); // Create the file menu
if (mBar != null)
mBar.add(fileMenu); // and add it to the menu bar
addMenuItem(fileMenu, "Open"); // Open item
addMenuItem(fileMenu, "Save"); // Save item
addMenuItem(fileMenu, "Save As"); // Save As item
fileMenu.addSeparator(); // Logical separator
addMenuItem(fileMenu, "Save-Exit"); // Save item
addMenuItem(fileMenu, "Quit"); // Quit item
return fileMenu;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Removes old file list and creates a new file list
* with the updated MRU list.
*/
protected void updateMRUList() {
JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0);
menu.removeAll();
menu.add(createOpenMI());
menu.add(createOpenURLMI());
menu.addSeparator();
menu.add(createCloseMI());
createMRUFileListMI(menu);
menu.addSeparator();
menu.add(createExitMI());
}
代码示例来源:origin: libgdx/libgdx
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");
代码示例来源: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: stanfordnlp/CoreNLP
JMenu file = new JMenu("File");
loadFiles = new JMenuItem("Load trees...");
loadFiles.addActionListener(this);
saveMatches = new JMenuItem("Save matched trees...");
saveMatches.addActionListener(this);
saveMatches.setEnabled(false);
saveSentences = new JMenuItem("Save matched sentences...");
saveSentences.addActionListener(this);
file.add(loadFiles);
file.add(loadTsurgeon);
file.addSeparator();
file.add(clearFileList);
file.addSeparator();
file.addSeparator();
file.addSeparator();
JMenu edit = new JMenu("Edit");
JMenu search = new JMenu("Search");
search.addSeparator();
mbar.add(file);
mbar.add(edit);
mbar.add(search);
代码示例来源: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;
}
代码示例来源:origin: deathmarine/Luyten
fileMenu.add(menuItem);
fileMenu.addSeparator();
menuItem = new JMenuItem("Close File");
menuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileMenu.add(menuItem);
fileMenu.addSeparator();
menuItem = new JMenuItem("Save As...");
menuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fileMenu.add(menuItem);
fileMenu.addSeparator();
recentFiles = new JMenu("Recent Files");
fileMenu.addSeparator();
代码示例来源:origin: deathmarine/Luyten
flattenSwitchBlocks.setSelected(settings.getFlattenSwitchBlocks());
flattenSwitchBlocks.addActionListener(settingsChanged);
settingsMenu.add(flattenSwitchBlocks);
settingsMenu.add(forceExplicitImports);
settingsMenu.add(forceExplicitTypes);
settingsMenu.add(debugLineNumbers);
JMenu debugSettingsMenu = new JMenu("Debug Settings");
showDebugInfo = new JCheckBoxMenuItem("Include Error Diagnostics");
showDebugInfo.setSelected(settings.getIncludeErrorDiagnostics());
debugSettingsMenu.add(showDebugInfo);
settingsMenu.add(debugSettingsMenu);
settingsMenu.addSeparator();
settingsMenu.add(bytecodeAST);
JMenu debugLanguagesMenu = new JMenu("Debug Languages");
for (final Language language : Languages.debug()) {
final JRadioButtonMenuItem m = new JRadioButtonMenuItem(language.getName());
内容来源于网络,如有侵权,请联系作者删除!