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


Java JRadioButton.addActionListener方法代码示例

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


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

示例1: GenealogyExample

import javax.swing.JRadioButton; //导入方法依赖的package包/类
public GenealogyExample() {
    super(new BorderLayout());

    // Construct the panel with the toggle buttons.
    JRadioButton showDescendant = new JRadioButton("Show descendants", true);
    final JRadioButton showAncestor = new JRadioButton("Show ancestors");
    ButtonGroup bGroup = new ButtonGroup();
    bGroup.add(showDescendant);
    bGroup.add(showAncestor);
    showDescendant.addActionListener(this);
    showAncestor.addActionListener(this);
    showAncestor.setActionCommand(SHOW_ANCESTOR_CMD);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(showDescendant);
    buttonPanel.add(showAncestor);

    // Construct the tree.
    tree = new GenealogyTree(getGenealogyGraph());
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(200, 200));

    // Add everything to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:GenealogyExample.java

示例2: createTutorialButton

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JRadioButton createTutorialButton(final WizardController controller, final Map settings) {
  JRadioButton b = new JRadioButton(Resources.getString("WizardSupport.LoadTutorial")); //$NON-NLS-1$
  b.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      controller.setProblem(Resources.getString("WizardSupport.LoadingTutorial")); //$NON-NLS-1$
      try {
        new TutorialLoader(controller, settings, new BufferedInputStream(tutorial.getTutorialContents()), POST_INITIAL_STEPS_WIZARD, tutorial).start();
      }
      catch (IOException e1) {
        logger.error("", e1);
        controller.setProblem(Resources.getString("WizardSupport.ErrorLoadingTutorial")); //$NON-NLS-1$
      }
    }
  });
  return b;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:WizardSupport.java

示例3: createLoadSavedGameButton

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JRadioButton createLoadSavedGameButton(final WizardController controller, final Map settings) {
  JRadioButton b = new JRadioButton(Resources.getString("WizardSupport.LoadSavedGame")); //$NON-NLS-1$
  b.addActionListener(new ActionListener() {
    @SuppressWarnings("unchecked")
    public void actionPerformed(ActionEvent e) {
      settings.put(WizardSupport.ACTION_KEY, LOAD_GAME_ACTION);
      Wizard wiz = new BranchingWizard(new LoadSavedGamePanels(), POST_LOAD_GAME_WIZARD).createWizard();
      settings.put(POST_INITIAL_STEPS_WIZARD, wiz);
      controller.setForwardNavigationMode(WizardController.MODE_CAN_CONTINUE);
      controller.setProblem(null);
    }
  });
  return b;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:WizardSupport.java

示例4: setRadioButtons

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private void setRadioButtons()
{
    int numeroScelte = progetto.scelteDomandaAttualeSize();
    ArrayList<String> testoScelte = new ArrayList();
    
    for(int i = 0; i < numeroScelte; i++)
        testoScelte.add(progetto.mostraSceltaDomandaAttuale(i));
    
    gruppo = new ButtonGroup();
    
    for(int i = 0; i < numeroScelte; i++)
    {
        JRadioButton radio = new JRadioButton(testoScelte.get(i));
        radio.setFont(fontScelta);
        RadioButtonListener rbl = new RadioButtonListener(progetto);
        radio.addActionListener(rbl);
        gruppo.add(radio);
        center.add(radio);
    }
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-I,代码行数:21,代码来源:ExecutePage.java

示例5: createModePanel

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JComponent createModePanel()
{
	basic = new JRadioButton(CurrentLocale.get("security.editor.mode.basic"));
	advanced = new JRadioButton(CurrentLocale.get("security.editor.mode.advanced"));
	inherited = new JRadioButton(CurrentLocale.get("security.editor.mode.inherited"));

	basic.addActionListener(this);
	advanced.addActionListener(this);
	inherited.addActionListener(this);

	ButtonGroup radiogroup = new ButtonGroup();
	radiogroup.add(basic);
	radiogroup.add(advanced);
	radiogroup.add(inherited);

	JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
	panel.add(basic);
	panel.add(advanced);
	panel.add(inherited);

	return panel;
}
 
开发者ID:equella,项目名称:Equella,代码行数:23,代码来源:AccessEditor.java

示例6: DeviceToggleRadioButtons

import javax.swing.JRadioButton; //导入方法依赖的package包/类
/**
 * @param modifier the boolean modifier controlled by this device
 * @param title     a descriptive string.  If empty ("") provides plain border; if null, provides no border.
 * @param trueText  text associated with "true" state of modifier
 * @param falseText text associated with "false" state of modifier
 */
public DeviceToggleRadioButtons(final ModifierBoolean modifier, 
                            String title, String trueText, String falseText) {

    java.awt.event.ActionListener al = new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            modifier.setBoolean(getState());
        }
    };
  
    trueButton = new JRadioButton(trueText, true);
    falseButton = new JRadioButton(falseText, false);
    trueButton.addActionListener(al);
    falseButton.addActionListener(al);
    ButtonGroup g = new ButtonGroup();
    g.add(trueButton);
    g.add(falseButton);
      
    panel = new JPanel();
    panel.add(trueButton);
    panel.add(falseButton);

    falseButton.setSelected(!modifier.getBoolean());
    setModifier(modifier);
    
    if(title != null /*&& !title.equals("")*/) setTitle(title);
}
 
开发者ID:etomica,项目名称:etomica,代码行数:33,代码来源:DeviceToggleRadioButtons.java

示例7: createPlayOnlineButton

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JRadioButton createPlayOnlineButton(final WizardController controller, final Map settings) {
  JRadioButton b = new JRadioButton(Resources.getString("WizardSupport.PlayOnline")); //$NON-NLS-1$
  b.addActionListener(new ActionListener() {
    @SuppressWarnings("unchecked")
    public void actionPerformed(ActionEvent e) {
      settings.put(WizardSupport.ACTION_KEY, PLAY_ONLINE_ACTION);
      controller.setForwardNavigationMode(WizardController.MODE_CAN_FINISH);
      controller.setProblem(null);
    }
  });
  return b;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:WizardSupport.java

示例8: createRadioButton

import javax.swing.JRadioButton; //导入方法依赖的package包/类
final public static JRadioButton createRadioButton(String strPkey, ActionListener al) {
	final JRadioButton objLjRadioButton = new JRadioButton(Tools.getLocaleString(strPkey));
	objLjRadioButton.setMnemonic(Tools.getMnemonicChar(strPkey));
	objLjRadioButton.addActionListener(al);

	return objLjRadioButton;
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:8,代码来源:PrintRangeSubJPanel.java

示例9: newRadio

import javax.swing.JRadioButton; //导入方法依赖的package包/类
public JRadioButton newRadio(ActionListener listener, ButtonGroup group) {
	JRadioButton button = new JRadioButton(name(), this == getDefault());
	button.setActionCommand(name());
	button.addActionListener(listener);
	group.add(button);
	return button;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:8,代码来源:ClassMatchingGui.java

示例10: makeGUIControl

import javax.swing.JRadioButton; //导入方法依赖的package包/类
@Override
public JRadioButton makeGUIControl() {

	final JRadioButton but = new JRadioButton("<html>" + getName() + ": " + getDescription());
	but.setToolTipText("<html>" + toString() + "<br>Select to set bit, clear to clear bit.");
	but.setSelected(value);
	but.setAlignmentX(Component.LEFT_ALIGNMENT);
	but.addActionListener(new SPIConfigBitAction(this));
	setControl(but);
	addObserver(biasgen);	// This observer is responsible for sending data to hardware
	addObserver(this);		// This observer is responsible for GUI update. It calls the updateControl() method
	return but;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:14,代码来源:SPIConfigBit.java

示例11: initGUI

import javax.swing.JRadioButton; //导入方法依赖的package包/类
@Override
public void initGUI()
{
	institution = new JTextField();
	secretId = new JTextField();
	secretValue = new JPasswordField();
	username = new JTextField();

	JLabel signInOptionLabel = new JLabel(s("signinoptions"));
	useCurrentUser = new JRadioButton(s("useloggedinuser"));
	useCurrentUser.addActionListener(this);
	useThisUser = new JRadioButton(s("usethisuser"));
	useThisUser.addActionListener(this);

	ButtonGroup group = new ButtonGroup();
	group.add(useCurrentUser);
	group.add(useThisUser);

	JPanel signInOptionPanel = new JPanel();
	signInOptionPanel.setLayout(new MigLayout("wrap 1, insets 0", "[fill,grow]"));
	signInOptionPanel.add(useCurrentUser);
	signInOptionPanel.add(useThisUser);
	signInOptionPanel.add(username, "gapleft 20");

	panel.add(new JLabel(s("institutionurl")));
	panel.add(institution);
	panel.add(new JLabel(s("secretid")));
	panel.add(secretId);
	panel.add(new JLabel(s("secretvalue")));
	panel.add(secretValue);
	panel.add(signInOptionLabel);
	panel.add(signInOptionPanel);
}
 
开发者ID:equella,项目名称:Equella,代码行数:34,代码来源:LearningEdgePlugin.java

示例12: createTop

import javax.swing.JRadioButton; //导入方法依赖的package包/类
protected void createTop()
{
	preRadio = new JRadioButton(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.rawhtmleditor.predefined")); //$NON-NLS-1$
	preRadio.addActionListener(new RawHtmlEditor.RadioHandler(false));
	preRadio.setSelected(true);

	preList = new JComboBox(ELEMENTS);

	prePanel = new JPanel(new BorderLayout(5, 5));
	prePanel.add(preRadio, BorderLayout.NORTH);
	prePanel.add(preList, BorderLayout.CENTER);
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:RawHtmlEditor.java

示例13: createFilterButton

import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JRadioButton createFilterButton(ButtonGroup group, String key)
{
	JRadioButton button = new JRadioButton(CurrentLocale.get(key));
	group.add(button);
	if( group.getButtonCount() == 1 )
	{
		button.setSelected(true);
	}
	button.addActionListener(this);
	return button;
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:SearchFinder.java

示例14: RevertType

import javax.swing.JRadioButton; //导入方法依赖的package包/类
RevertType(JRadioButton button) {
    this.button = button;
    button.addActionListener(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:RevertModifications.java

示例15: createSizePanel

import javax.swing.JRadioButton; //导入方法依赖的package包/类
/**
 * @return
 */
private Component createSizePanel() {
	
	final ButtonGroup buttons = new ButtonGroup();
	JPanel jp = new MyJPanel("Node Size", Color.RED);
	
	mNodeSizeDegreeSlider = new JSlider(JSlider.HORIZONTAL);
	mNodeSizeDegreeSlider.setPreferredSize(new Dimension(180, 40));
	mNodeSizeDegreeSlider.setPaintTicks(true);
	mNodeSizeDegreeSlider.setBackground(Color.WHITE);
	mNodeSizeDegreeSlider.setValue(0);
	final JRadioButton degree = new JRadioButton("Degree");
	degree.setBackground(Color.WHITE);
	degree.setSelected(true);	
	buttons.add(degree);
	jp.add( degree );
	
	jp.add(mNodeSizeDegreeSlider);
	
	mNodeSizePageRankSlider = new JSlider(JSlider.HORIZONTAL);
	mNodeSizePageRankSlider.setPreferredSize(new Dimension(180, 40));
	mNodeSizePageRankSlider.setPaintTicks(true);
	mNodeSizePageRankSlider.setBackground(Color.WHITE);
	mNodeSizePageRankSlider.setEnabled( false );
	final JRadioButton rank = new JRadioButton("PageRank with Prior");
	rank.setBackground(Color.WHITE);
	buttons.add(rank);
	
	jp.add( rank );
	jp.add( mNodeSizePageRankSlider);

	ActionListener al = new ActionListener() {

		public void actionPerformed(ActionEvent e) {
			if( e.getSource() == rank) {
				mNodeSizePageRankSlider.setEnabled(true);
				mNodeSizeDegreeSlider.setEnabled(false);
			} 
			if ( e.getSource() == degree) {
				mNodeSizePageRankSlider.setEnabled(false);
				mNodeSizeDegreeSlider.setEnabled(true);
			}
		}
		
	};
	degree.addActionListener(al);
	rank.addActionListener(al);
	
	return jp;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:53,代码来源:RankingDemo.java


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