Java Code Examples for javax.swing.JMenu#setText()
The following examples show how to use
javax.swing.JMenu#setText() .
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: DataTableFrame.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Adds a Display menu to the menu bar. */ protected JMenu loadDisplayMenu() { JMenuBar menuBar = getJMenuBar(); if(menuBar==null) { return null; } JMenu displayMenu = new JMenu(); displayMenu.setText(DisplayRes.getString("DataTableFrame.Display_menu_title")); //$NON-NLS-1$ menuBar.add(displayMenu); JMenuItem setFontItem = new JMenuItem(DisplayRes.getString("DataTableFrame.NumberFormat_menu_item_title")); //$NON-NLS-1$ setFontItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setNumberFormat(); } }); displayMenu.add(setFontItem); return displayMenu; }
Example 2
Source File: ExportFormatManager.java From IrScrutinizer with GNU General Public License v3.0 | 6 votes |
private void createMenu(String selection) { menu = new JMenu(); menu.setText("Export formats"); menu.setToolTipText("Allows direct selection of export format"); buttonGroup = new ButtonGroup(); for (String formatName : toArray()) { final String name = formatName; JMenuItem menuItem = new JCheckBoxMenuItem(name); menuItem.setSelected(name.equals(selection)); menuItem.addActionListener((java.awt.event.ActionEvent evt) -> { exportFormatSelector.select(name); }); buttonGroup.add(menuItem); menu.add(menuItem); } }
Example 3
Source File: ConflictsMenu.java From netbeans with Apache License 2.0 | 5 votes |
@Override public JMenuItem getPopupPresenter() { JMenu menu = createMenu(); menu.setText(Bundle.CTL_MenuItem_ConflictsMenu_popupName()); enableMenu(menu); return menu; }
Example 4
Source File: RQueries.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static String getName(Query query, Query current, JMenu owner) { String name = query.getName(); if (sameQuery(query, current)) { name = "<html><b>" + name + "</b> <span style='color: gray;'>" + Bundle.RQueries_CurrentScriptFlag() + "</span></html>"; // NOI18N if (owner != null) owner.setText("<html><b>" + owner.getText() + "</b></html>"); // NOI18N } return name; }
Example 5
Source File: OQLQueries.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static String getName(OQLSupport.Query query, OQLSupport.Query current, JMenu owner) { String name = query.getName(); if (sameQuery(query, current)) { name = "<html><b>" + name + "</b> <span style='color: gray;'>" + Bundle.OQLQueries_CurrentScriptFlag() + "</span></html>"; // NOI18N if (owner != null) owner.setText("<html><b>" + owner.getText() + "</b></html>"); // NOI18N } return name; }
Example 6
Source File: PCGenMenuBar.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private JMenu createToolsMenu() { JMenu menu = new JMenu(); menu.setText(LanguageBundle.getString("in_mnuTools")); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.PREFERENCES_COMMAND))); menu.addSeparator(); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.LOG_COMMAND))); menu.add(new LoggingLevelMenu()); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.CALCULATOR_COMMAND))); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.COREVIEW_COMMAND))); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.SOLVERVIEW_COMMAND))); return menu; }
Example 7
Source File: Hiero.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); } } } }
Example 8
Source File: QueuesMenu.java From netbeans with Apache License 2.0 | 5 votes |
@Override public JMenuItem getPopupPresenter() { JMenu menu = createMenu(); menu.setText(Bundle.CTL_MenuItem_QueuesMenu_popupName()); enableMenu(menu); return menu; }
Example 9
Source File: MapMenu.java From megamek with GNU General Public License v2.0 | 5 votes |
private JMenu createStandMenu() { JMenu menu = new JMenu(); if (selectedEntity.isProne()) { menu.setText("Stand"); menu.add(createStandJMenuItem(false)); if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_CAREFUL_STAND) && (myEntity.getWalkMP() > 2) && (myEntity.moved == EntityMovementType.MOVE_NONE)) { menu.add(createStandJMenuItem(true)); } if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_HULL_DOWN)) { menu.add(createHullDownJMenuItem()); } } else if (selectedEntity.isHullDown()) { menu.setText("Stand"); menu.add(createStandJMenuItem(false)); if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_CAREFUL_STAND)) { menu.add(createStandJMenuItem(true)); } menu.add(createProneJMenuItem()); } else { menu.setText("Prone"); menu.add(createProneJMenuItem()); if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_TACOPS_HULL_DOWN)) { menu.add(createHullDownJMenuItem()); } } return menu; }
Example 10
Source File: ActionMappings.java From netbeans with Apache License 2.0 | 5 votes |
@Messages("ActionMappings.globalVar=Reference IDE Global Variable") private static JMenu createGlobalVarSubmenu(JTextComponent area) { JMenu menu = new JMenu(); menu.setText(ActionMappings_globalVar()); Map<String, String> vars = DefaultReplaceTokenProvider.readVariables(); boolean hasAny = false; for (Map.Entry<String, String> ent : vars.entrySet()) { hasAny = true; menu.add(new UseGlobalVarAction(area, ent.getKey())); } if (!hasAny) { menu.setEnabled(false); } return menu; }
Example 11
Source File: MapMenu.java From megamek with GNU General Public License v2.0 | 5 votes |
private JMenu createTorsoTwistMenu() { JMenu menu = new JMenu(); if (myEntity instanceof BipedMech) { menu.setText("Torso Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } else if ((myEntity instanceof Tank) && (((Tank) myEntity).getInternal(((Tank) myEntity) .getLocTurret()) > -1)) { menu.setText("Turret Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } if ((myEntity instanceof Tank) && !((Tank) myEntity).hasNoDualTurret()) { menu.add(createRotateDualTurretJMenuItem((Tank) myEntity)); } return menu; }
Example 12
Source File: RemoteMenu.java From netbeans with Apache License 2.0 | 5 votes |
@Override public JMenuItem getPopupPresenter() { JMenu menu = createMenu(); menu.setText(Bundle.CTL_MenuItem_RemoteMenu_popupName()); enableMenu(menu); return menu; }
Example 13
Source File: PCGenMenuBar.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private JMenu createToolsMenu() { JMenu menu = new JMenu(); menu.setText(LanguageBundle.getString("in_mnuTools")); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.PREFERENCES_COMMAND))); menu.addSeparator(); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.LOG_COMMAND))); menu.add(new LoggingLevelMenu()); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.CALCULATOR_COMMAND))); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.COREVIEW_COMMAND))); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.SOLVERVIEW_COMMAND))); return menu; }
Example 14
Source File: AbstractMenuFactory.java From netbeans with Apache License 2.0 | 5 votes |
public JMenu createMenu (String containerContext) { System.err.println("Creating a menu: " + containerContext); JMenu result = new JMenu(); result.putClientProperty (KEY_CONTAINERCONTEXT, containerContext); result.setName(containerContext); result.setText (getEngine().getContainerProvider().getDisplayName( ContainerProvider.TYPE_MENU, containerContext)); populateMenu(containerContext, result); //XXX listener should do this attachToMenu(result); return result; }
Example 15
Source File: PCGenMenuBar.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private JMenu createHelpMenu() { JMenu menu = new JMenu(); menu.setText(LanguageBundle.getString("in_mnuHelp")); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.HELP_DOCS_COMMAND))); menu.addSeparator(); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.HELP_OGL_COMMAND))); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.HELP_TIPOFTHEDAY_COMMAND))); menu.addSeparator(); menu.add(new JMenuItem(actionMap.get(PCGenActionMap.HELP_ABOUT_COMMAND))); return menu; }
Example 16
Source File: ActionMappings.java From netbeans with Apache License 2.0 | 5 votes |
@Messages("ActionMappings.fileExpressions=IDE Selection Expressions") private static JMenu createFileSelectionSubmenu(JTextComponent area) { JMenu menu = new JMenu(); menu.setText(ActionMappings_fileExpressions()); menu.add(new FileVariableAction(area, "packageClassName")); menu.add(new FileVariableAction(area, "className")); menu.add(new FileVariableAction(area, "classNameWithExtension")); menu.add(new FileVariableAction(area, "webPagePath")); menu.add(new FileVariableAction(area, "classPathScope")); menu.add(new FileVariableAction(area, "absolutePathName")); return menu; }
Example 17
Source File: MainDialog.java From LibraryManagementSystem with MIT License | 4 votes |
private JMenuBar createMenu() { JMenuBar menuBar = new JMenuBar(); //�����鼮���� JMenu bookMenu = new JMenu("�鼮����(B)"); bookMenu.setMnemonic(KeyEvent.VK_B); bookMenu.add(MenuActions.BOOK_ADD); bookMenu.add(MenuActions.BOOK_ADD2); bookMenu.add(MenuActions.BOOK_PRICE); bookMenu.add(MenuActions.BOOK_SEARCH); //��������֤���� JMenu readerMenu = new JMenu("����֤����(R)"); readerMenu.setMnemonic(KeyEvent.VK_R); readerMenu.add(MenuActions.READER_ADD); readerMenu.add(MenuActions.READER_OWN); readerMenu.add(MenuActions.READER_SEARCH); //������ܹ��� JMenu bsMenu = new JMenu("��ܹ���(S)"); bsMenu.setMnemonic(KeyEvent.VK_S); bsMenu.add(MenuActions.BS_ADD); bsMenu.add(MenuActions.BS_SEARCH); //����һ��ͼ����Ĺ���IJ˵�����ֱ���¼� JMenu borrowManageMenu=new JMenu(); borrowManageMenu.setText("���Ĺ���(O)"); borrowManageMenu.setMnemonic(KeyEvent.VK_O); borrowManageMenu.add(MenuActions.BORROW); borrowManageMenu.add(MenuActions.RETURN); borrowManageMenu.add(MenuActions.BORROW_SEARCH); //����һ��ϵͳ����˵��һ���û��������� JMenu sysManageMenu = new JMenu(); sysManageMenu.setText("ϵͳ����(M)"); sysManageMenu.setMnemonic(KeyEvent.VK_M); JMenu userManageMItem=new JMenu("�û�����"); userManageMItem.add(MenuActions.USER_ADD); userManageMItem.add(MenuActions.MODIFY_PASSWORD); sysManageMenu.add(userManageMItem); sysManageMenu.add(MenuActions.DATABASE_BACKUP); sysManageMenu.add(MenuActions.EXIT); //���˵������˵��� menuBar.add(bookMenu); menuBar.add(readerMenu); menuBar.add(borrowManageMenu); menuBar.add(bsMenu); menuBar.add(sysManageMenu); return menuBar; }
Example 18
Source File: ActionManager.java From audiveris with GNU Affero General Public License v3.0 | 4 votes |
/** * Register all actions as listed in the descriptor files, and organize them * according to the various domains defined. * There is one pull-down menu generated for each domain found. */ public void registerAllActions () { // Insert an initial separator, to let user easily grab the toolBar toolBar.addSeparator(); DomainLoop: for (String domain : Actions.getDomainNames()) { // Create dedicated menu for this range, if not already existing JMenu menu = menuMap.get(domain); if (menu == null) { logger.debug("Creating menu:{}", domain); menu = new SeparableMenu(domain); menuMap.put(domain, menu); } else { logger.debug("Augmenting menu:{}", domain); } // Proper menu decoration ResourceMap resource = OmrGui.getApplication().getContext().getResourceMap( Actions.class); menu.setText(domain); // As default menu.setName(domain); // Register all actions in the given domain registerDomainActions(domain, menu); resource.injectComponents(menu); // Localized SeparableMenu.trimSeparator(menu); // No separator at end of menu // Smart insertion of the menu into the menu bar, and separators into the toolBar if (menu.getItemCount() > 0) { final int toolCount = toolBar.getComponentCount(); if (toolCount > 0) { Component comp = toolBar.getComponent(toolCount - 1); if (!(comp instanceof JToolBar.Separator)) { toolBar.addSeparator(); } } menuBar.add(menu); } } }
Example 19
Source File: ZooFrame.java From JavaMainRepo with Apache License 2.0 | 4 votes |
public void setClock(JMenuBar panel) { JMenu clockMenu = new JMenu(); // List of possible GMT JButton[] timeZones = new JButton[24]; timeZones[0] = new JButton("GMT-12"); timeZones[1] = new JButton("GMT-11"); timeZones[2] = new JButton("GMT-10"); timeZones[3] = new JButton("GMT-9"); timeZones[4] = new JButton("GMT-8"); timeZones[5] = new JButton("GMT-7"); timeZones[6] = new JButton("GMT-6"); timeZones[7] = new JButton("GMT-5"); timeZones[8] = new JButton("GMT-4"); timeZones[9] = new JButton("GMT-3"); timeZones[10] = new JButton("GMT-2"); timeZones[11] = new JButton("GMT-1"); timeZones[12] = new JButton("GMT"); timeZones[13] = new JButton("GMT+1"); timeZones[14] = new JButton("GMT+2"); timeZones[15] = new JButton("GMT+3"); timeZones[16] = new JButton("GMT+4"); timeZones[17] = new JButton("GMT+5"); timeZones[18] = new JButton("GMT+6"); timeZones[19] = new JButton("GMT+7"); timeZones[20] = new JButton("GMT+8"); timeZones[21] = new JButton("GMT+9"); timeZones[22] = new JButton("GMT+10"); timeZones[23] = new JButton("GMT+11"); clockMenu.setFont(new Font(clockMenu.getFont().getName(), Font.PLAIN, 28)); panel.add(clockMenu, BorderLayout.LINE_END); // Every button will have the same listener ClockController listener = new ClockController(); for (int i = 0; i < timeZones.length; i++) { timeZones[i].addActionListener(listener); timeZones[i].setMargin(new Insets(0, 0, 0, 0)); timeZones[i].setContentAreaFilled(false); timeZones[i].setBorderPainted(false); timeZones[i].setOpaque(false); clockMenu.add(timeZones[i]); } Thread clock = new Thread() { public void run() { String GMT; for (;;) { GMT = listener.getButtonPressedText(); Calendar cal; if (GMT == null) { cal = Calendar.getInstance(); } else { cal = Calendar.getInstance(TimeZone.getTimeZone(GMT)); } int second = cal.get(Calendar.SECOND); int minute = cal.get(Calendar.MINUTE); int hours = cal.get(Calendar.HOUR_OF_DAY); clockMenu.setText(hours + ":" + minute + ":" + second); try { sleep(100); } catch (InterruptedException e) { } } } }; clock.start(); }
Example 20
Source File: ResourceBundleSupport.java From ccu-historian with GNU General Public License v3.0 | 3 votes |
/** * Returns a JMenu created from a resource bundle definition. * <p> * The menu definition consists of two keys, the name of the menu and the * mnemonic for that menu. Both keys share a common prefix, which is * extended by ".name" for the name of the menu and ".mnemonic" for the * mnemonic.</p> * * <pre> * # define the file menu * menu.file.name=File * menu.file.mnemonic=F * </pre> * The menu definition above can be used to create the menu by calling * <code>createMenu ("menu.file")</code>. * * @param keyPrefix the common prefix for that menu * @return the created menu */ public JMenu createMenu(final String keyPrefix) { final JMenu retval = new JMenu(); retval.setText(getString(keyPrefix + ".name")); retval.setMnemonic(getMnemonic(keyPrefix + ".mnemonic").intValue()); return retval; }