Java Code Examples for javax.swing.JMenu#setOpaque()

The following examples show how to use javax.swing.JMenu#setOpaque() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapEditorMenuBar.java    From freecol with GNU General Public License v2.0 6 votes vote down vote up
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(NewEmptyMapAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(OpenAction.id));
    menu.add(getMenuItem(SaveAction.id));
    menu.add(getMenuItem(StartMapAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(PreferencesAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(ShowMainAction.id));
    menu.add(getMenuItem(QuitAction.id));

    add(menu);
}
 
Example 2
Source File: MapEditorMenuBar.java    From freecol with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: SwingSet3.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected JMenu createLookAndFeelMenu() {
        JMenu menu = new LuckMenu();
        menu.setOpaque(true);
//        menu.setBackground(Color.white);
        menu.setName("lookAndFeel");
        
        // Look for toolkit look and feels first
        UIManager.LookAndFeelInfo lookAndFeelInfos[] = UIManager.getInstalledLookAndFeels();
        lookAndFeel = UIManager.getLookAndFeel().getClass().getName();
        lookAndFeelRadioGroup = new ButtonGroup();
        for(UIManager.LookAndFeelInfo lafInfo: lookAndFeelInfos) {
            menu.add(createLookAndFeelItem(lafInfo.getName(), lafInfo.getClassName()));
        }  
        // Now load any look and feels defined externally as service via java.util.ServiceLoader
        LOOK_AND_FEEL_LOADER.iterator();
        for (LookAndFeel laf : LOOK_AND_FEEL_LOADER) {           
            menu.add(createLookAndFeelItem(laf.getName(), laf.getClass().getName()));
        }
         
        return menu;
    }
 
Example 4
Source File: MapEditorMenuBar.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
private void buildToolsMenu() {
    // --> Tools
    JMenu menu = Utility.localizedMenu("menuBar.tools");
    menu.setOpaque(false);
    menu.setMnemonic(KeyEvent.VK_T);

    menu.add(getMenuItem(ScaleMapAction.id));
    menu.add(getMenuItem(DetermineHighSeasAction.id));

    add(menu);
}
 
Example 5
Source File: FreeColMenuBar.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: InGameMenuBar.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: InGameMenuBar.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
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(DisplayBordersAction.id));
    menu.add(getMenuItem(ToggleViewModeAction.id));
    menu.add(getCheckBoxMenuItem(ChangeWindowedModeAction.id));

    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();
    for (DisplayText type : DisplayText.values()) {
        menu.add(getRadioButtonMenuItem(DisplayTileTextAction.id
                + type.getKey(), group));
    }

    menu.addSeparator();
    menu.add(getMenuItem(ZoomInAction.id));
    menu.add(getMenuItem(ZoomOutAction.id));
    menu.add(getMenuItem(CenterAction.id));
    menu.add(getMenuItem(TilePopupAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(EuropeAction.id));
    menu.add(getMenuItem(TradeRouteAction.id));
    menu.add(getMenuItem(FindSettlementAction.id));

    add(menu);
}
 
Example 8
Source File: InGameMenuBar.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 9
Source File: BETitlePane.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
	 * Returns the <code>JMenu</code> displaying the appropriate menu items
	 * for manipulating the Frame.
	 *
	 * @return the j menu
	 */
	private JMenu createMenu()
	{
		JMenu menu = new JMenu("");
//		menu.setRolloverEnabled(false);//本行一定要!这是Java 1.5之Metal主题的Bug! -- jack,2009-09-11
		menu.setOpaque(false);//本行一定要,否则将导致窗口图标区会绘制Menu的背景!这是Java Metal主题的Bug! -- jack,2009-09-11
		if (getWindowDecorationStyle() == JRootPane.FRAME
				||getWindowDecorationStyle() == JRootPane.PLAIN_DIALOG//现在也给dialog加上菜单项(但只有关闭项)
			)
		{
			addMenuItems(menu);
		}
		return menu;
	}
 
Example 10
Source File: InGameMenuBar.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
private void buildOrdersMenu() {
    // --> Orders
    JMenu menu = Utility.localizedMenu("menuBar.orders");
    menu.setOpaque(false);
    menu.setMnemonic(KeyEvent.VK_O);

    menu.add(getMenuItem(SentryAction.id));
    menu.add(getMenuItem(FortifyAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(GotoAction.id));
    menu.add(getMenuItem(GotoTileAction.id));
    menu.add(getMenuItem(ExecuteGotoOrdersAction.id));
    menu.add(getMenuItem(AssignTradeRouteAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(BuildColonyAction.id));
    // Insert all Improvements here:
    for (TileImprovementType type : freeColClient.getGame().getSpecification()
             .getTileImprovementTypeList()) {
        if (!type.isNatural()) {
            menu.add(getMenuItem(type.getSuffix() + "Action"));
        }
    }
    menu.addSeparator();

    menu.add(getMenuItem(LoadAction.id));
    menu.add(getMenuItem(UnloadAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(WaitAction.id));
    menu.add(getMenuItem(SkipUnitAction.id));
    menu.add(getMenuItem(ChangeAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(ClearOrdersAction.id));
    menu.add(getMenuItem(RenameAction.id));
    menu.add(getMenuItem(DisbandUnitAction.id));

    add(menu);
}