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


Java ButtonGroup.add方法代码示例

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


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

示例1: DirectionButton

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
/**
 * A layout direction button
 */
public DirectionButton(Icon icon, Icon downIcon, String direction,
        String description, ActionListener l,
        ButtonGroup group, boolean selected) {
    super();
    this.addActionListener(l);
    setFocusPainted(false);
    setHorizontalTextPosition(CENTER);
    group.add(this);
    setIcon(icon);
    setSelectedIcon(downIcon);
    setActionCommand(direction);
    getAccessibleContext().setAccessibleName(direction);
    getAccessibleContext().setAccessibleDescription(description);
    setSelected(selected);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:DirectionPanel.java

示例2: getContextMenu

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
/** Updates items in popup menu and returns itself.
*/
public JPopupMenu getContextMenu () {
    removeAll ();

    // generate list of available toolbar panels
    ButtonGroup bg = new ButtonGroup ();
    String current = ToolbarPool.getDefault ().getConfiguration ();
    for( String name : ToolbarPool.getDefault().getConfigurationsNow() ) {
        JRadioButtonMenuItem mi = new JRadioButtonMenuItem (name, (name.compareTo (current) == 0));
        mi.addActionListener (this);
        bg.add (mi);
        this.add (mi);
    }

    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ToolbarPool.java

示例3: PrintIconRadioJButton

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public PrintIconRadioJButton(	ControlJFrame objPcontrolJFrame,
								String strPkey,
								String strPimage,
								boolean bolPselected,
								ButtonGroup objPbuttonGroup,
								ActionListener objPactionListener) {

	// Create widgets :
	this.objGjLabel =
						new ExtendedJLabel(objPcontrolJFrame, objPcontrolJFrame	.getJuggleMasterPro()
																				.getImageIcon(strPimage, Constants.bytS_UNCLASS_NO_VALUE));
	this.objGjRadioButton = new JRadioButton(Tools.getLocaleString(strPkey));
	this.objGjRadioButton.setFont(objPcontrolJFrame.getFont());
	this.objGjRadioButton.setOpaque(true);
	this.objGjRadioButton.setMnemonic(Tools.getMnemonicChar(strPkey));
	this.objGjRadioButton.addActionListener(objPactionListener);
	this.objGjRadioButton.setSelected(bolPselected);
	objPbuttonGroup.add(this.objGjRadioButton);

	// Add widgets :
	this.setLayout(new FlowLayout(FlowLayout.LEADING));
	this.add(this.objGjLabel);
	this.add(this.objGjRadioButton);
	this.setOpaque(true);
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:26,代码来源:PrintIconRadioJButton.java

示例4: createOpenViewButton

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
protected JToggleButton createOpenViewButton(ButtonGroup group,
                                             final SubView view) {
    JToggleButton button = new JToggleButton(view.getTitle());
    group.add(button);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            actionsRemoved(activeView.getActions());
            beforeSubviewActivated(view);
            content.removeAll();
            content.add(view, BorderLayout.CENTER);
            content.revalidate();
            content.repaint();
            activeView = view;
            actionsAdded(view.getActions());
        }
    });

    return button;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:22,代码来源:ReportEditorView.java

示例5: initSave

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
void initSave() {
	savePanel = new JPanel(new GridLayout(0,1));
	savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
	ButtonGroup gp = new ButtonGroup();
	saveToFile = new JToggleButton("Save ASCII table");
	savePanel.add( saveToFile );
	gp.add( saveToFile );
	saveToClipboard = new JToggleButton("Copy to clipboard");
	savePanel.add( saveToClipboard );
	gp.add( saveToClipboard );
	saveJPEG = new JToggleButton("Save JPEG image");
	savePanel.add( saveJPEG );
	gp.add( saveJPEG );
	savePNG = new JToggleButton("Save PNG image");
	savePanel.add( savePNG );
	gp.add( savePNG );
	print = new JToggleButton("Print");
	savePanel.add( print );
	gp.add( print );
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:21,代码来源:GMAProfile.java

示例6: SectorPanel

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public SectorPanel()
{
	super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.restrictwarning"), false); //$NON-NLS-1$

	restrict = new JRadioButton(
		CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.restrictedu"), true); //$NON-NLS-1$
	selectable = new JRadioButton(
		CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.contributor")); //$NON-NLS-1$

	ButtonGroup group = new ButtonGroup();
	group.add(restrict);
	group.add(selectable);

	final int height = restrict.getPreferredSize().height;
	final int[] rows = {height, height};
	final int[] cols = {TableLayout.FILL};

	setInnerLayout(new TableLayout(rows, cols, 5, 5));
	addInner(restrict, new Rectangle(0, 0, 1, 1));
	addInner(selectable, new Rectangle(0, 1, 1, 1));

	setSelected(false);
}
 
开发者ID:equella,项目名称:Equella,代码行数:24,代码来源:DRMRightsTab.java

示例7: createButton

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
private JRadioButton createButton(JPanel panel, ButtonGroup group, String textKey)
{
	JRadioButton button = new JRadioButton(CurrentLocale.get(textKey));
	button.addItemListener(this);
	group.add(button);
	panel.add(button);
	return button;
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:BasicEditorPanel.java

示例8: setupGUI

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
private void setupGUI()
{
	setShowScripting(true);

	createTop();
	createBottom();

	ButtonGroup group = new ButtonGroup();
	group.add(preRadio);
	group.add(userRadio);

	addSection(prePanel);
	addSection(userPanel);
}
 
开发者ID:equella,项目名称:Equella,代码行数:15,代码来源:RawHtmlEditor.java

示例9: PopuleBarra

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public void PopuleBarra(JComponent obj) {
    ButtonGroup buttons = new ButtonGroup();
    Barra = obj;

    Acao ac = new Acao(editor, "?", "Controler.interface.BarraLateral.Nothing.img", "Controler.interface.BarraLateral.Nothing.Texto", null);
    JToggleButton btn = arrume(new JToggleButton(ac));
    buttons.add(btn);
    obj.add(btn);
    btn.setSelected(true);
    ac.IDX = -1;
    this.BtnNothing = btn;
    int i = 0;
    for (ConfigAcao ca : Lista) {
        if (ca.tipo == TipoConfigAcao.tpBotoes || ca.tipo == TipoConfigAcao.tpAny) {
            ac = new Acao(editor, ca.texto, ca.ico, ca.descricao, ca.command);
            ac.IDX = i++;
            btn = arrume(new JToggleButton(ac));
            buttons.add(btn);
            //obj.add(btn);
            listaBotoes.put(ca.command, btn);
        }
    }
    menuComandos c = menuComandos.cmdDel;
    String str = "Controler.comandos." + c.toString().substring(3).toLowerCase();
    ac = new Acao(editor, Editor.fromConfiguracao.getValor(str + ".descricao"), str + ".img", str + ".descricao", c.toString());
    ListaDeAcoesEditaveis.add(ac);
    ac.normal = false;
    JButton btn2 = new JButton(ac);
    btn2.setHideActionText(true);
    btn2.setFocusable(false);
    btn2.setPreferredSize(new Dimension(40, 40));
    obj.add(btn2);

    LayoutManager la = obj.getLayout();
    if (la instanceof GridLayout) {
        ((GridLayout) la).setRows(i + 2);
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:39,代码来源:Controler.java

示例10: SettingsPanel

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public SettingsPanel() {
    styleGroup = new ButtonGroup();
    styleGroup.add(defaultStyleButton);
    styleGroup.add(gsonStyleButton);
    styleGroup.add(jacksonStyleButton);
    styleGroup.add(moshiStyleButton);

    Collections.list(styleGroup.getElements()).forEach(button -> button.addActionListener(this));
    classNamePrefixField.getDocument().addDocumentListener(this);
    classNameSuffixField.getDocument().addDocumentListener(this);

    generatedAnnotationCheckBox.addActionListener(this);
    suppressWarningsAnnotationCheckBox.addActionListener(this);
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:15,代码来源:SettingsPanel.java

示例11: initGUI

import javax.swing.ButtonGroup; //导入方法依赖的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: setup

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
@Override
public void setup()
{
	showFull = new JCheckBox(s("showfullscreen"));
	showFullNewWindow = new JCheckBox(s("showfullscreen.newwindow"));
	modeStructured = new JRadioButton(s("displaymode.structured.title"));
	modeThumbnail = new JRadioButton(s("displaymode.thumbnail.title"));
	metadataTarget = new MultiTargetChooser(schemaModel, "");

	ButtonGroup bg = new ButtonGroup();
	bg.add(modeStructured);
	bg.add(modeThumbnail);

	changeDetector = new ChangeDetector();
	changeDetector.watch(showFull);
	changeDetector.watch(showFullNewWindow);
	changeDetector.watch(modeStructured);
	changeDetector.watch(modeThumbnail);
	changeDetector.watch(metadataTarget);

	setLayout(new MigLayout("wrap", "[]"));

	super.setup();

	add(new JLabel(s("fullscreen")), "gaptop 2u");
	add(showFull, "gap 2i");
	add(showFullNewWindow, "gap 2i");

	add(new JLabel(s("displaymode")), "gaptop 2u");

	add(modeStructured, "gap i*2");
	add(new JLabel("<html>" + s("displaymode.structured.description")), "gap i*4");

	add(modeThumbnail, "gap i*2");
	add(new JLabel("<html>" + s("displaymode.thumbnail.description")), "gap i*4");

	add(new JLabel(s("restrict")), "gaptop 2u, grow");
	add(new JLabel("<html>" + s("restrict.help")), "gap 2i");
	add(metadataTarget, "grow, gap 2i");
}
 
开发者ID:equella,项目名称:Equella,代码行数:41,代码来源:AttachmentsSectionConfig.java

示例13: createToolBar

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
/** Creates a tool bar for the label tree. */
public JToolBar createToolBar() {
    JToolBar result = Options.createToolBar();
    result.add(getShowSubtypesButton());
    result.add(getShowSupertypesButton());
    result.addSeparator();
    result.add(getShowAllLabelsButton());
    result.add(getCollapseAllButton());
    // put the sub- and supertype buttons in a button group
    ButtonGroup modeButtonGroup = new ButtonGroup();
    modeButtonGroup.add(getShowSubtypesButton());
    modeButtonGroup.add(getShowSupertypesButton());
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:15,代码来源:TypeTree.java

示例14: DeviceToggleRadioButtons

import javax.swing.ButtonGroup; //导入方法依赖的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

示例15: Menus

import javax.swing.ButtonGroup; //导入方法依赖的package包/类
public Menus()
{
	items = new HashMap <String,JMenuItem>();
    Messenger.register(MT.SERIES_CHANGED, this);
	Messenger.register(MT.EVENT_CHANGED, this);

	/* File Menu */
	JMenu file = new JMenu("File");
	add(file);

	file.add(new OpenSeriesAction());
	file.add(new QuitAction());

	/* Edit Menu */
	edit = new JMenu("Edit");
	add(edit);
	edit.add(new EventSendAction("Quick Entry", MT.QUICKID_SEARCH, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK)));
    edit.add(new EventSendAction("Filter Table", MT.OPEN_FILTER, KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK)));
	edit.add(new EventSendAction("Manual Barcode Entry", MT.OPEN_BARCODE_ENTRY, KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK)));

	/* Event Menu */
	event = new JMenu("Event Options");
	add(event);	

	/* Runs Submenu */
	runGrouping = new ButtonGroup();
	JMenu runs = new JMenu("Set Runs");
	event.add(runs);
	for (int ii = 2; ii <= 20; ii++)
	{
		JRadioButtonMenuItem m = new JRadioButtonMenuItem(ii + " Runs");
		m.addActionListener(this);
		runGrouping.add(m);
		runs.add(m);
	}

	paidInfoMode = new JCheckBoxMenuItem("Highlight Unpaid Entries", Prefs.usePaidFlag());
	paidInfoMode.addActionListener(this);
	event.add(paidInfoMode);

	reorderMode = new JCheckBoxMenuItem("Constant Staging Mode", Prefs.useReorderingTable());
	reorderMode.addActionListener(this);
	event.add(reorderMode);
	
	event.add(new BarcodeScannerOptionsAction());


	/* Results Menu */
	results = new JMenu("Reports");
	add(results);

	JMenu audit = new JMenu("Current Group Audit");
	audit.add(createItem("In Run Order", null));
	audit.add(createItem("Order By First Name", null));
	audit.add(createItem("Order By Last Name", null));
	
	results.add(createItem("Multiple Group Results", null));
	results.add(audit);
	results.add(createItem("Results Page", null));
	results.add(createItem("Admin Page", null));
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:62,代码来源:Menus.java


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