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


Java JRadioButtonMenuItem.setActionCommand方法代码示例

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


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

示例1: 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:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:MetalThemeMenu.java

示例2: getTimerMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
/**
 * Get the menu used for this timer
 * @return a JMenu for use by the application
 */
public JMenu getTimerMenu()
{
	JMenu timerMenu = new JMenu("Timer");
	for (Mode m : Mode.values())
	{
		JRadioButtonMenuItem bm = new JRadioButtonMenuItem();
		bm.setActionCommand(m.name());
		bm.addActionListener(this);
		timerMenu.add(bm);
		modeGroup.add(bm);
		switch (m)
		{
			case OFF: bm.setText("Off"); break;
			case BASIC_SERIAL: bm.setText("FarmTek/RaceAmerica/JACircuits"); break;
			case BWTIMER_SERIAL: bm.setText("BWTimer Serial"); break;
			case BWTIMER_NETWORK: bm.setText("BWTimer Network"); break;
			case PROTIMER_NETWORK: bm.setText("ProTimer Network"); break;
		}
	}

	modeGroup.setSelected(Mode.OFF);
	return timerMenu;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:28,代码来源:TimeEntry.java

示例3: 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

示例4: getEditMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private JMenu getEditMenu() {
	JMenu editMenu = new JMenu("Edit");

	editModeButton = new JRadioButtonMenuItem("Edit Mode");
	editModeButton.setActionCommand(ACTION_COMMAND_EDIT_MODE);
	editModeButton.addActionListener(this);
	editModeButton.setAccelerator(KeyStroke.getKeyStroke('E', altKey));
	editMenu.add(editModeButton);
	

	analysisModeButton = new JRadioButtonMenuItem("Analyse Mode");
	analysisModeButton.setActionCommand(ACTION_COMMAND_ANALYSIS_MODE);
	analysisModeButton.addActionListener(this);
	analysisModeButton.setAccelerator(KeyStroke.getKeyStroke('A', altKey));
	editMenu.add(analysisModeButton);

	ButtonGroup editOrAnalyseGroup = new ButtonGroup();
	editOrAnalyseGroup.add(editModeButton);
	editOrAnalyseGroup.add(analysisModeButton);

	return editMenu;
}
 
开发者ID:iig-uni-freiburg,项目名称:SWAT20,代码行数:23,代码来源:SwatMenuBar.java

示例5: addRadioItem

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
protected JRadioButtonMenuItem addRadioItem(JMenu menu, String text, ButtonGroup buttonGroup) {
   boolean selected = false;
   for (int i = 1; !selected; ++i) {
      String selection = Persist.get("#." + menu.getText() + "." + i);
      if (selection == null) {
         break;
      }
      selected = Persist.match("#." + selection, "#." + i + "." + text);
   }
   JRadioButtonMenuItem item = new JRadioButtonMenuItem(text, selected);
   menu.add(item);
   item.setActionCommand(text);
   item.addActionListener(this);
   buttonGroup.add(item);
   return item;
}
 
开发者ID:pushkarkp,项目名称:twidlit,代码行数:17,代码来源:PersistentMenuBar.java

示例6: ZoomMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public ZoomMenu() {
  super();

  sep = new JPopupMenu.Separator();
  add(sep);

  bg = new ButtonGroup();

  other = new JRadioButtonMenuItem(
    Resources.getString("Zoomer.ZoomMenu.other")); //$NON-NLS-1$
  other.setActionCommand(OTHER);
  other.addActionListener(this);
  bg.add(other);
  add(other);

  addSeparator();

  final JMenuItem fw = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_width")); //$NON-NLS-1$
  fw.setActionCommand(FIT_WIDTH);
  fw.addActionListener(this);
  add(fw);

  final JMenuItem fh = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_height")); //$NON-NLS-1$
  fh.setActionCommand(FIT_HEIGHT);
  fh.addActionListener(this);
  add(fh);

  final JMenuItem fv = new JMenuItem(
    Resources.getString("Zoomer.ZoomMenu.fit_visible")); //$NON-NLS-1$
  fv.setActionCommand(FIT_VISIBLE);
  fv.addActionListener(this);
  add(fv);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:36,代码来源:Zoomer.java

示例7: setBrowserListPopupMenu

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
private void setBrowserListPopupMenu(List<String> browsers) {
    JRadioButtonMenuItem browserMenuItem;
    for (String browser : browsers) {
        browsersMenu.add(browserMenuItem = new JRadioButtonMenuItem(browser));
        browserMenuItem.setActionCommand(browser);
        browserMenuItem.addItemListener((ItemEvent ie) -> {
            if (ie.getStateChange() == ItemEvent.SELECTED) {
                String selBrowser = ((JRadioButtonMenuItem) ie.getSource()).getText() + ". Right Click to change the browser";
                runButton.setToolTipText("Run [F6] - with " + selBrowser);
                debugButton.setToolTipText("Debug [Ctrl+F6] - with " + selBrowser);
            }
        });
        browserSelectButtonGroup.add(browserMenuItem);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:16,代码来源:TestCaseToolBar.java

示例8: 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

示例9: createLookAndFeelItem

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
protected JRadioButtonMenuItem createLookAndFeelItem(String lafName, String lafClassName) {
    JRadioButtonMenuItem lafItem = new LuckRadioButtonMenuItem();

    lafItem.setSelected(lafClassName.equals(lookAndFeel));
    lafItem.setHideActionText(true);
    lafItem.setAction(getAction("setLookAndFeel"));
    lafItem.setText(lafName);
    lafItem.setActionCommand(lafClassName);
    lookAndFeelRadioGroup.add(lafItem);
    
    return lafItem;
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:13,代码来源:SwingSet3.java

示例10: createLookAndFeelItem

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
protected JRadioButtonMenuItem createLookAndFeelItem(String lafName, String lafClassName) {
    JRadioButtonMenuItem lafItem = new JRadioButtonMenuItem();

    lafItem.setSelected(lafClassName.equals(lookAndFeel));
    lafItem.setHideActionText(true);
    lafItem.setAction(getAction("setLookAndFeel"));
    lafItem.setText(lafName);
    lafItem.setActionCommand(lafClassName);
    lookAndFeelRadioGroup.add(lafItem);
    
    return lafItem;
}
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:13,代码来源:SwingSet3.java

示例11: internalFrameOpened

import javax.swing.JRadioButtonMenuItem; //导入方法依赖的package包/类
public void internalFrameOpened(InternalFrameEvent e) {
	System.out.println("internalFrameOpened: " + e.paramString());

	ButtonGroup btnGroup = (ButtonGroup) mainMenu.getWindowMenu().getClientProperty(ButtonGroup.class);

	JRadioButtonMenuItem cbmi = new JRadioButtonMenuItem(e.getInternalFrame().getTitle());
	cbmi.setActionCommand(MainMenu.ACTIONCOMMAND_WINDOW_ACTIVATE);
	btnGroup.add(cbmi);

	cbmi.putClientProperty(DocumentView.class, e.getInternalFrame());
	cbmi.addActionListener(this);
	mainMenu.getWindowMenu().add(cbmi);

}
 
开发者ID:afpdev,项目名称:herculesafpeditor,代码行数:15,代码来源:MainWindow.java


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