當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。