本文整理汇总了Java中java.awt.Menu.addSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java Menu.addSeparator方法的具体用法?Java Menu.addSeparator怎么用?Java Menu.addSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Menu
的用法示例。
在下文中一共展示了Menu.addSeparator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProjectMenu
import java.awt.Menu; //导入方法依赖的package包/类
private static Menu initProjectMenu() {
Menu mnProject = new Menu(Resources.get("menu_project"));
CheckboxMenuItem compress = new CheckboxMenuItem(Resources.get("menu_compressProjectFile"));
compress.setState(userPreferences.isCompressFile());
compress.addItemListener(e -> userPreferences.setCompressFile(compress.getState()));
CheckboxMenuItem sync = new CheckboxMenuItem(Resources.get("menu_syncMaps"));
sync.setState(userPreferences.isSyncMaps());
sync.addItemListener(e -> userPreferences.setSyncMaps(sync.getState()));
MenuItem importSpriteFile = new MenuItem(Resources.get("menu_assets_importSpriteFile"));
importSpriteFile.addActionListener(a -> EditorScreen.instance().importSpriteFile());
MenuItem importSprite = new MenuItem(Resources.get("menu_assets_importSprite"));
importSprite.addActionListener(a -> EditorScreen.instance().importSprites());
mnProject.add(importSprite);
mnProject.add(importSpriteFile);
mnProject.addSeparator();
mnProject.add(compress);
mnProject.add(sync);
return mnProject;
}
示例2: addMenuItems
import java.awt.Menu; //导入方法依赖的package包/类
/**
* Method declaration
*
*
* @param f
* @param m
*/
private void addMenuItems(Menu f, String[] m) {
for (int i = 0; i < m.length; i++) {
if (m[i].equals("-")) {
f.addSeparator();
} else {
MenuItem item = new MenuItem(m[i]);
item.addActionListener(this);
f.add(item);
}
}
}
示例3: initFileMenu
import java.awt.Menu; //导入方法依赖的package包/类
private static Menu initFileMenu() {
Menu mnFile = new Menu(Resources.get("menu_file"));
MenuItem create = new MenuItem(Resources.get("menu_createProject"));
create.setShortcut(new MenuShortcut(KeyEvent.VK_N));
create.addActionListener(a -> EditorScreen.instance().create());
MenuItem load = new MenuItem(Resources.get("menu_loadProject"));
load.setShortcut(new MenuShortcut(KeyEvent.VK_O));
load.addActionListener(a -> EditorScreen.instance().load());
MenuItem save = new MenuItem(Resources.get("menu_save"));
save.setShortcut(new MenuShortcut(KeyEvent.VK_S));
save.addActionListener(a -> EditorScreen.instance().save(false));
MenuItem saveAs = new MenuItem(Resources.get("menu_saveAs"));
saveAs.addActionListener(a -> EditorScreen.instance().save(true));
MenuItem exit = new MenuItem(Resources.get("menu_exit"));
exit.setShortcut(new MenuShortcut(KeyEvent.VK_Q));
exit.addActionListener(a -> Game.terminate());
mnFile.add(load);
mnFile.add(create);
mnFile.add(save);
mnFile.add(saveAs);
mnFile.addSeparator();
recentFiles = new Menu(Resources.get("menu_recentFiles"));
loadRecentFiles();
mnFile.add(recentFiles);
mnFile.addSeparator();
mnFile.add(exit);
return mnFile;
}
示例4: addMenuItems
import java.awt.Menu; //导入方法依赖的package包/类
/**
* Method declaration
*
*
* @param f
* @param m
*/
private void addMenuItems(Menu f, String m[]) {
for (int i = 0; i < m.length; i++) {
if (m[i].equals("-")) {
f.addSeparator();
} else {
MenuItem item = new MenuItem(m[i]);
item.addActionListener(this);
f.add(item);
}
}
}
示例5: initViewMenu
import java.awt.Menu; //导入方法依赖的package包/类
private static Menu initViewMenu() {
Menu mnView = new Menu(Resources.get("menu_view"));
CheckboxMenuItem snapToGrid = new CheckboxMenuItem(Resources.get("menu_snapGrid"));
snapToGrid.setState(userPreferences.isSnapGrid());
EditorScreen.instance().getMapComponent().snapToGrid = snapToGrid.getState();
snapToGrid.addItemListener(e -> {
EditorScreen.instance().getMapComponent().snapToGrid = snapToGrid.getState();
userPreferences.setSnapGrid(snapToGrid.getState());
});
CheckboxMenuItem renderGrid = new CheckboxMenuItem(Resources.get("menu_renderGrid"));
renderGrid.setState(userPreferences.isShowGrid());
EditorScreen.instance().getMapComponent().renderGrid = renderGrid.getState();
renderGrid.setShortcut(new MenuShortcut(KeyEvent.VK_G));
renderGrid.addItemListener(e -> {
EditorScreen.instance().getMapComponent().renderGrid = renderGrid.getState();
userPreferences.setShowGrid(renderGrid.getState());
});
CheckboxMenuItem renderCollision = new CheckboxMenuItem(Resources.get("menu_renderCollisionBoxes"));
renderCollision.setState(userPreferences.isRenderBoundingBoxes());
EditorScreen.instance().getMapComponent().renderCollisionBoxes = renderCollision.getState();
renderCollision.setShortcut(new MenuShortcut(KeyEvent.VK_H));
renderCollision.addItemListener(e -> {
EditorScreen.instance().getMapComponent().renderCollisionBoxes = renderCollision.getState();
userPreferences.setRenderBoundingBoxes(renderCollision.getState());
});
MenuItem setGrid = new MenuItem(Resources.get("menu_gridSize"));
setGrid.addActionListener(a -> {
GridEditPanel panel = new GridEditPanel(EditorScreen.instance().getMapComponent().getGridSize());
int option = JOptionPane.showConfirmDialog(null, panel, Resources.get("menu_gridSettings"), JOptionPane.DEFAULT_OPTION);
if (option == JOptionPane.OK_OPTION) {
EditorScreen.instance().getMapComponent().setGridSize(panel.getGridSize());
}
});
MenuItem zoomIn = new MenuItem(Resources.get("menu_zoomIn"));
zoomIn.setShortcut(new MenuShortcut(KeyEvent.VK_PLUS));
zoomIn.addActionListener(a -> EditorScreen.instance().getMapComponent().zoomIn());
MenuItem zoomOut = new MenuItem(Resources.get("menu_zoomOut"));
zoomOut.setShortcut(new MenuShortcut(KeyEvent.VK_MINUS));
zoomOut.addActionListener(a -> EditorScreen.instance().getMapComponent().zoomOut());
mnView.add(snapToGrid);
mnView.add(renderGrid);
mnView.add(renderCollision);
mnView.add(setGrid);
mnView.addSeparator();
mnView.add(zoomIn);
mnView.add(zoomOut);
return mnView;
}
示例6: initMapMenu
import java.awt.Menu; //导入方法依赖的package包/类
private static Menu initMapMenu() {
Menu mnMap = new Menu(Resources.get("menu_map"));
MenuItem imp = new MenuItem(Resources.get("menu_import"));
imp.addActionListener(a -> EditorScreen.instance().getMapComponent().importMap());
MenuItem exp = new MenuItem(Resources.get("menu_export"));
exp.addActionListener(a -> EditorScreen.instance().getMapComponent().exportMap());
MenuItem del2 = new MenuItem(Resources.get("menu_removeMap"));
del2.addActionListener(a -> EditorScreen.instance().getMapComponent().deleteMap());
MenuItem mapProps = new MenuItem(Resources.get("menu_properties"));
mapProps.setShortcut(new MenuShortcut(KeyEvent.VK_M));
mapProps.addActionListener(a -> {
if (EditorScreen.instance().getMapComponent().getMaps() == null || EditorScreen.instance().getMapComponent().getMaps().isEmpty()) {
return;
}
MapPropertyPanel panel = new MapPropertyPanel();
panel.bind(Game.getEnvironment().getMap());
int option = JOptionPane.showConfirmDialog(null, panel, Resources.get("menu_mapProperties"), JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION) {
panel.saveChanges();
final String colorProp = Game.getEnvironment().getMap().getCustomProperty(MapProperty.AMBIENTCOLOR);
try {
if (Game.getEnvironment().getMap().getCustomProperty(MapProperty.AMBIENTALPHA) != null) {
int alpha = Integer.parseInt(Game.getEnvironment().getMap().getCustomProperty(MapProperty.AMBIENTALPHA));
Game.getEnvironment().getAmbientLight().setAlpha(alpha);
}
if (colorProp != null && !colorProp.isEmpty()) {
Color ambientColor = Color.decode(colorProp);
Game.getEnvironment().getAmbientLight().setColor(ambientColor);
}
} catch (final NumberFormatException nfe) {
log.log(Level.SEVERE, nfe.getLocalizedMessage(), nfe);
}
EditorScreen.instance().getMapComponent().loadMaps(EditorScreen.instance().getGameFile().getMaps());
EditorScreen.instance().getMapComponent().loadEnvironment((Map) Game.getEnvironment().getMap());
EditorScreen.instance().mapChanged();
}
});
mnMap.add(imp);
mnMap.add(exp);
mnMap.add(del2);
mnMap.addSeparator();
mnMap.add(mapProps);
return mnMap;
}
示例7: setupTray
import java.awt.Menu; //导入方法依赖的package包/类
public static synchronized void setupTray() {
popup.removeAll();
if (pausedTime.get() != -1L && pausedTime.get() > System.currentTimeMillis()) {
MenuItem resume = new MenuItem("Resume");
resume.addActionListener(new PauseActionListener(-1L));
popup.add(resume);
} else {
pausedTime.set(-1);
MenuItem recheck = new MenuItem("Force Recheck");
recheck.addActionListener(new ForceRecheckListener());
popup.add(recheck);
Menu pauseMenu = new Menu("Pause");
MenuItem pause = new MenuItem("Pause");
pause.addActionListener(new PauseActionListener(365 * 24 * 60 * 60 * 1000L));
pauseMenu.add(pause);
MenuItem pause1 = new MenuItem("Pause - 1 hour");
pause1.addActionListener(new PauseActionListener(1 * 60 * 60 * 1000L));
pauseMenu.add(pause1);
MenuItem pause3 = new MenuItem("Pause - 3 hours");
pause3.addActionListener(new PauseActionListener(3 * 60 * 60 * 1000L));
pauseMenu.add(pause3);
MenuItem pause6 = new MenuItem("Pause - 6 hours");
pause6.addActionListener(new PauseActionListener(6 * 60 * 60 * 1000L));
pauseMenu.add(pause6);
MenuItem pause12 = new MenuItem("Pause - 12 hours");
pause12.addActionListener(new PauseActionListener(12 * 60 * 60 * 1000L));
pauseMenu.add(pause12);
popup.add(pauseMenu);
}
Menu serverList = new Menu("Server List");
MenuItem addServer = new MenuItem("Add Server");
addServer.addActionListener(new ServerEntryListener());
serverList.add(addServer);
serverList.addSeparator();
popup.add(serverList);
for (ServerEntry entry : servers) {
Menu server = new Menu(entry.getAlias());
MenuItem edit = new MenuItem("Edit");
server.add(edit);
edit.addActionListener(new ServerEntryListener(entry));
MenuItem remove = new MenuItem("Remove");
server.add(remove);
remove.addActionListener(new RemoveServerListener(entry, remove));
serverList.add(server);
}
MenuItem exit = new MenuItem("Exit");
exit.addActionListener(new ExitActionListener());
popup.add(exit);
}