本文整理汇总了Java中javax.swing.JMenu.addSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java JMenu.addSeparator方法的具体用法?Java JMenu.addSeparator怎么用?Java JMenu.addSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenu
的用法示例。
在下文中一共展示了JMenu.addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFittingMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
private void getFittingMenubar(String mode) {
JMenuBar jmb = new JMenuBar();
JMenuItem[][] menuItems = { { new JMenuItem(FI_FILE_NEW), null, new JMenuItem(FI_FILE_EXIT) },
{ new JMenuItem(FI_HELP), null, new JMenuItem(FI_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]);
if (i == 0 && (j == 0 && mode.equals("demo"))) {
menuItems[i][j].setEnabled(false);
}
}
}
jmb.add(menu);
}
setMenuBar(jmb);
}
示例2: buildViewMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void buildViewMenu() {
// --> View
JMenu menu = Utility.localizedMenu("menuBar.view");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_V);
menu.add(getCheckBoxMenuItem(MapControlsAction.id));
menu.add(getCheckBoxMenuItem(DisplayGridAction.id));
menu.add(getCheckBoxMenuItem(ChangeWindowedModeAction.id));
menu.addSeparator();
ButtonGroup tileTextGroup = new ButtonGroup();
for (DisplayText type : DisplayText.values()) {
menu.add(getRadioButtonMenuItem(DisplayTileTextAction.id + type.getKey(),
tileTextGroup));
}
menu.addSeparator();
menu.add(getMenuItem(ZoomInAction.id));
menu.add(getMenuItem(ZoomOutAction.id));
add(menu);
}
示例3: createExploreMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Creates and returns an exploration menu for the menu bar.
*/
private JMenu createExploreMenu() {
JMenu result = new JMenu();
result.setMnemonic(Options.EXPLORE_MENU_MNEMONIC);
result.setText(Options.EXPLORE_MENU_NAME);
result.add(getActions().getExplorationDialogAction());
result.addSeparator();
result.add(getActions().getStartSimulationAction());
result.add(getActions().getApplyMatchAction());
result.add(getActions().getAnimateAction());
result.add(getActions().getExploreAction());
result.addSeparator();
result.add(getActions().getBackAction());
result.add(getActions().getForwardAction());
result.add(getActions().getGotoStartStateAction());
result.add(getActions().getGotoFinalStateAction());
result.addSeparator();
result.add(getActions().getSaveLTSAsAction());
result.addSeparator();
result.add(getActions().getExplorationStatsDialogAction());
return result;
}
示例4: 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);
}
示例5: makeMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Creates workload analysis menu
* @return menu
*/
public void makeMenubar() {
workloadMenubar = new JMenuBar();
JMenuItem[][] menuItems = { { new JMenuItem(HELP),null,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);
}
示例6: InputFrame
import javax.swing.JMenu; //导入方法依赖的package包/类
public InputFrame(){
panel = new InputPanel(254);
Container c = this.getContentPane();
c.setLayout(new BorderLayout());
c.add(new JScrollPane(panel), BorderLayout.CENTER);
JButton jb = new JButton("Transfer");
//add menu bar
JMenuBar jmb = new JMenuBar();
JMenu menu = new JMenu("File");
jmb.add(menu);
initMenuItems(); //! da drin schreiben (und im InputPanel)
menu.add(miSave);
menu.add(miSaveAs);
menu.add(miLoad);
menu.addSeparator(); //! ...trennstrich im menü, dann dein item
menu.add(miExport);
this.setJMenuBar(jmb);
}
示例7: 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);
}
示例8: 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);
}
}
}
}
示例9: getFittingMenubar
import javax.swing.JMenu; //导入方法依赖的package包/类
private void getFittingMenubar() {
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(FI_FILE_NEW), null, new JMenuItem(FI_FILE_EXIT) },
{ new JMenuItem(FI_HELP), null, new JMenuItem(FI_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);
}
示例10: getWorkloadMenuBar
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Creates workload analysis menu
* @return menu
*/
private void getWorkloadMenuBar() {
JMenuBar workloadMenubar = new JMenuBar();
JMenuItem[][] menuItems = {
{ new JMenuItem(WL_FILE_NEW), new JMenuItem(WL_FILE_SAVE), new JMenuItem(WL_FILE_OPEN), null, new JMenuItem(WL_EXIT_ACTION) },
{ new JMenuItem(WL_ACTION_SOLVE) {
{
setEnabled(false);
}
} }, { new JMenuItem(WL_HELP_SHOWHELP) {
{
setEnabled(true);
}
}, 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]);
}
}
workloadMenubar.add(menu);
}
setMenuBar(workloadMenubar);
}
示例11: createMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private JMenu createMenu () {
JMenu menu = new JMenu(this);
org.openide.awt.Mnemonics.setLocalizedText(menu, Bundle.CTL_Menu_ShelveChanges());
VCSContext ctx = VCSContext.forNodes(TopComponent.getRegistry().getActivatedNodes());
for (JComponent item : getMenuActions(ctx, null)) {
if (item == null) {
menu.addSeparator();
} else {
menu.add(item);
}
}
enableMenu(menu);
return menu;
}
示例12: addAction
import javax.swing.JMenu; //导入方法依赖的package包/类
protected void addAction(JTextComponent target, JMenu menu,
String actionName) {
BaseKit kit = Utilities.getKit(target);
if (kit == null) return;
Action a = kit.getActionByName(actionName);
if (a!=null){
addAction(target, menu, a);
} else { // action-name is null, add the separator
menu.addSeparator();
}
}
示例13: 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);
}
示例14: addSeparator
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Appends a separator to the given parent menu.
* @param menuName the name of the parent menu
*/
public void addSeparator(String menuName) {
JMenu menu = (JMenu) parentMenus.get(menuName);
if (menu != null)
menu.addSeparator();
}
示例15: 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);
}