本文整理汇总了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);
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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;
}
示例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;
}
示例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);
}