当前位置: 首页>>代码示例>>Java>>正文


Java JRadioButtonMenuItem.setSelected方法代码示例

本文整理汇总了Java中javax.swing.JRadioButtonMenuItem.setSelected方法的典型用法代码示例。如果您正苦于以下问题:Java JRadioButtonMenuItem.setSelected方法的具体用法?Java JRadioButtonMenuItem.setSelected怎么用?Java JRadioButtonMenuItem.setSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JRadioButtonMenuItem的用法示例。


在下文中一共展示了JRadioButtonMenuItem.setSelected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPopupPresenter

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public JMenuItem getPopupPresenter() {
    JMenu displayAsPopup = new JMenu();
    Mnemonics.setLocalizedText(displayAsPopup, NbBundle.getMessage(DebuggingActionsProvider.class, "CTL_Session_Popup_Language"));

    String [] languages = session.getSupportedLanguages();
    String currentLanguage = session.getCurrentLanguage();
    for (int i = 0; i < languages.length; i++) {
        final String language = languages[i];
        JRadioButtonMenuItem langItem = new JRadioButtonMenuItem(new AbstractAction(language) {
            public void actionPerformed(ActionEvent e) {
                session.setCurrentLanguage(language);
            }
        });
        if (currentLanguage.equals(language)) langItem.setSelected(true);
        displayAsPopup.add(langItem);
    }
    return displayAsPopup;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DebuggingActionsProvider.java

示例2: MetalThemeMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
public MetalThemeMenu(String name, MetalTheme[] themeArray) {
    super(name);
    themes = themeArray;
    ButtonGroup group = new ButtonGroup();
    for (int i = 0; i < themes.length; i++) {
        JRadioButtonMenuItem item = new JRadioButtonMenuItem(themes[i].
                getName());
        group.add(item);
        add(item);
        item.setActionCommand(i + "");
        item.addActionListener(this);
        if (i == 0) {
            item.setSelected(true);
        }
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:MetalThemeMenu.java

示例3: load

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public void load() {
	ButtonGroup group = new ButtonGroup();

	removeAll();

	for (TranslationUnit unit : I18n.registeredUnits()) {
		Language language = unit.getLanguage();
		String text = language.getName();
		JRadioButtonMenuItem item = new JRadioButtonMenuItem(text);

		group.add(item);
		item.addActionListener(event -> {
			item.setSelected(true);
			unitSelected(unit);
		});

		if (unit == I18n.currentUnit()) {
			item.setSelected(true);
		}

		CountryFlagRetrieveThread thread = new CountryFlagRetrieveThread(language, image -> EventQueue.invokeLater(() -> item.setIcon(new ImageIcon(image))));

		thread.start();
		add(item);
	}
}
 
开发者ID:BloodShura,项目名称:MPSBot,代码行数:27,代码来源:JLanguageMenu.java

示例4: updateLookAndFeels

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
protected void updateLookAndFeels()
   {
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
    return;
}

for (LookAndFeelInfo info : infoArray) {
    JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
    button.setActionCommand(info.getClassName());
    if (info.getName().equals(current))
	button.setSelected(true);
    addButton(button);
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:19,代码来源:LookAndFeelMenuItem.java

示例5: selectPartMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private void selectPartMenu(JMenuBar menubar) {
	SbApp.trace("SbActionManager.selectPartMenu(" + menubar.getName() + ")");
	//JMenu menu = menubar.getMenu(MENUBAR_INDEX_PARTS);
	JMenu menu=mainMenu.menuParts;
	Component[] comps = menu.getMenuComponents();
	for (Component comp : comps) {
		if (comp instanceof JRadioButtonMenuItem) {
			JRadioButtonMenuItem rbmi = (JRadioButtonMenuItem) comp;
			ChangePartAction action = (ChangePartAction) rbmi.getAction();
			if (action.getPart().getId().equals(mainFrame.getCurrentPart().getId())) {
				rbmi.setSelected(true);
				return;
			}
		}
	}
}
 
开发者ID:kennanmeyer,项目名称:SE-410-Project,代码行数:17,代码来源:SbActionManager.java

示例6: populateAudioQualityMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private void populateAudioQualityMenu() {
    ButtonGroup audioQualityButtons = new ButtonGroup();

    for (AudioQuality quality : AudioQuality.values()) {
        final AudioQuality fq = quality;
        JRadioButtonMenuItem mitem = new JRadioButtonMenuItem(
                new AbstractAction(quality.toString()) {

                    public void actionPerformed(ActionEvent arg0) {
                        setAudioQuality(fq);
                    }
                });

        audioQualityMenu.add(mitem);
        audioQualityButtons.add(mitem);

        SoftphoneControlImpl softphoneControlImpl =
                SoftphoneControlImpl.getInstance();

        if (quality.equals(softphoneControlImpl.getAudioQuality())) {
            mitem.setSelected(true);
        }
    }

    audioQualityMenu.setEnabled(true);
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:27,代码来源:AudioMenu.java

示例7: makeGradingMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private JMenu makeGradingMenu() {
   JMenu menu = new JMenu(getString(KEY_GRADING_MENU));
   buttonToi18nKeyMap.put(menu, () -> getString(KEY_GRADING_MENU));
   GradingMode selectedMode = getUser().getCurrentGradingMode();
   ButtonGroup group = new ButtonGroup();
   modeMap = new HashMap<GradingMode, AbstractButton>();
   for (GradingMode mode : getUser().getGradingModeManager().getGradingModeValues()) {
      String text = mode.geti18nString();
      JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(new AbstractAction(text) {
         @Override
         public void actionPerformed(ActionEvent e) {
            getUser().setGradingMode(mode);
         }
      });
      if (mode.equals(selectedMode)) {
         menuItem.setSelected(true);
      }
      group.add(menuItem);
      menu.add(menuItem);
      modeMap.put(mode, menuItem);
      buttonToi18nKeyMap.put(menuItem, () -> mode.geti18nString());
   }
   return menu;
}
 
开发者ID:Loreinator,项目名称:Shuffle-Move,代码行数:25,代码来源:ShuffleMenuBar.java

示例8: makeMenuItem

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/**
 * Creates a JMenuItem for this source list style. When the menu item is
 * activated, it applies the appropriate style to the given context.
 * 
 * @param context
 *            The session context the menu item belongs to (and operates
 *            upon).
 * @param sourceListStyleGroup
 *            The button group to add the menu item to (for mutual
 *            exclusion).
 * @return
 */
public JMenuItem makeMenuItem(
        final WabitSwingSessionContextImpl context,
        ButtonGroup sourceListStyleGroup) {
    JRadioButtonMenuItem mi =
        new JRadioButtonMenuItem(getLocalizedName() + " Source List");
    sourceListStyleGroup.add(mi);
    if (context.sourceListStyle == this) {
        // doing this before adding the action listener seems wise
        mi.setSelected(true);
    }
    mi.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            apply(context, context.currentEditorPanel);
        }
    });
    return mi;
}
 
开发者ID:SQLPower,项目名称:wabit,代码行数:30,代码来源:WabitSwingSessionContextImpl.java

示例9: createChoice

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private JMenuItem createChoice(final JavaProjectSettings.PackageViewType type, String label) {
    JRadioButtonMenuItem item = new JRadioButtonMenuItem();
    Mnemonics.setLocalizedText(item, label);
    item.setSelected(JavaProjectSettings.getPackageViewType() == type);
    item.addActionListener(new ActionListener() {
        @Override public void actionPerformed(ActionEvent e) {
            JavaProjectSettings.setPackageViewType(type);
        }
    });
    return item;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ChangePackageViewTypeAction.java

示例10: update

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
@Override
public void update(Subject o) {
	for(JRadioButtonMenuItem layoutButton : layoutMap.keySet() ) {
		if(layoutMap.get(layoutButton) == networkPanel.getCurrentLayout() ) {
			layoutButton.setSelected(true);
		}
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:9,代码来源:LayoutMenu.java

示例11: update

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
@Override
public void update(Subject o) {
	for (JRadioButtonMenuItem layoutButton : layoutMap.keySet()) {
		if (layoutMap.get(layoutButton) == networkPanel.getCurrentLayout()) {
			layoutButton.setSelected(true);
		}
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:9,代码来源:LayoutMenu.java

示例12: obtainMenuItem

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
protected final JRadioButtonMenuItem obtainMenuItem () {
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem();
    Mnemonics.setLocalizedText(menuItem, filterItem.getDisplayName());
    menuItem.setAction(this);
    menuItem.addHierarchyListener(new ParentChangeListener(menuItem));
    menuItem.setSelected(filterItem.isSelected());
    return menuItem;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:FiltersDescriptor.java

示例13: setProjectView4DevOrUser

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/**
 * Configures the View for menue 'view' -> 'Developer' or 'End user' 
 */
private void setProjectView4DevOrUser() {
	
	JRadioButtonMenuItem viewDeveloper = Application.getMainWindow().viewDeveloper; 
	JRadioButtonMenuItem viewEndUser = Application.getMainWindow().viewEndUser; 
	
	if (this.count()==0) {
		// --- Disable both MenuItems -----------------
		viewDeveloper.setEnabled(false);
		viewEndUser.setEnabled(false);
	} else {
		// --- Enable both MenuItems ------------------
		viewDeveloper.setEnabled(true);
		viewEndUser.setEnabled(true);
		
		// --- select the right item in relation ------  
		// --- to the project 					 ------
		String viewConfigured = Application.getProjectFocused().getProjectView();
		if (viewConfigured.equalsIgnoreCase(Project.VIEW_User)) {
			viewDeveloper.setSelected(false);
			viewEndUser.setSelected(true);
		} else {
			viewEndUser.setSelected(false);
			viewDeveloper.setSelected(true);
		}
		Application.getProjectFocused().getProjectEditorWindow().setViewForDeveloperOrEndUser();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:31,代码来源:ProjectsLoaded.java

示例14: createViewLogLinesSubMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private void createViewLogLinesSubMenu(final MenuActionListener menuActionLisener,
                                       final JMenu edit) {
  final JMenu viewLogLines = new JMenu(menuLabels.getString("viewMaxLines"));
  edit.add(viewLogLines);
  final ButtonGroup logLinesGroup = new ButtonGroup();
  for (final MenuActions maxLogLines : MenuActions.logLines()) {
    final JRadioButtonMenuItem submenuItem = new JRadioButtonMenuItem("Maximum " //NOPMD
        + maxLogLines.getLines());
    viewLogLines.add(submenuItem);
    logLinesGroup.add(submenuItem);
    submenuItem.setSelected(maxLogLines.getLines() == view.getMaxLogLines());
    submenuItem.addActionListener(menuActionLisener);
    submenuItem.setActionCommand(maxLogLines.name());
  }
}
 
开发者ID:zaplatynski,项目名称:second-hand-log,代码行数:16,代码来源:ConsoleMenu.java

示例15: DeBroglieViewMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public DeBroglieViewMenu( HAModule module ) {
    super( HAResources.getString( "menu.deBroglieView" ) );
    setMnemonic( HAResources.getChar( "menu.deBroglieView.mnemonic", 'D' ) );

    _module = module;
    
    _radialDistanceMenuItem = new JRadioButtonMenuItem( HAResources.getString( "menu.deBroglieView.radialDistance" ) );
    _height3DMenuItem = new JRadioButtonMenuItem( HAResources.getString( "menu.deBroglieView.height3D" ) );
    _brightnessMenuItem = new JRadioButtonMenuItem( HAResources.getString( "menu.deBroglieView.brightness" ) );

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add( _radialDistanceMenuItem );
    buttonGroup.add( _height3DMenuItem );
    buttonGroup.add( _brightnessMenuItem );

    add( _radialDistanceMenuItem );
    add( _height3DMenuItem );
    add( _brightnessMenuItem );

    // Event handling
    ActionListener listener = new ActionListener() {
        public void actionPerformed( ActionEvent e ) {
            handledeBroglieViewChange( e.getSource() );
        }
    };
    _radialDistanceMenuItem.addActionListener( listener );
    _height3DMenuItem.addActionListener( listener );
    _brightnessMenuItem.addActionListener( listener );

    // Default state
    if ( HADefaults.DEBROGLIE_VIEW == DeBroglieView.BRIGHTNESS ) {
        _brightnessMenuItem.setSelected( true );
    }
    else if ( HADefaults.DEBROGLIE_VIEW == DeBroglieView.RADIAL_DISTANCE ) {
        _radialDistanceMenuItem.setSelected( true );
    }
    else if ( HADefaults.DEBROGLIE_VIEW == DeBroglieView.HEIGHT_3D ) {
        _height3DMenuItem.setSelected( true );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:DeBroglieViewMenu.java


注:本文中的javax.swing.JRadioButtonMenuItem.setSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。