本文整理汇总了Java中javax.swing.ButtonGroup类的典型用法代码示例。如果您正苦于以下问题:Java ButtonGroup类的具体用法?Java ButtonGroup怎么用?Java ButtonGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ButtonGroup类属于javax.swing包,在下文中一共展示了ButtonGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TelaBuscarVeiculo
import javax.swing.ButtonGroup; //导入依赖的package包/类
public TelaBuscarVeiculo() {
initComponents();
jtb_Veiculos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ButtonGroup group = new ButtonGroup();
group.add(jrb_Marca);
group.add(jrb_Modelo);
group.add(jrb_Ano);
group.add(jrb_MenorPreco);
group.add(jrb_MaiorPreco);
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment( JLabel.CENTER );
jtb_Veiculos.setDefaultRenderer(Object.class, centerRenderer);
}
示例2: setRadioButtons
import javax.swing.ButtonGroup; //导入依赖的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);
}
}
示例3: connect
import javax.swing.ButtonGroup; //导入依赖的package包/类
public void connect(PropertyEditor pe, PropertyEnv env) {
if (!tableUI && (env != null) && useTitle) {
setBorder(new TitledBorder(env.getFeatureDescriptor().getDisplayName()));
} else {
setBorder(null);
}
editor = pe;
String[] tags = editor.getTags();
group = new ButtonGroup();
InvRadioButton[] buttons = getButtons(tags.length);
if (env != null) {
setEnabled(env.isEditable());
}
for (int i = 0; i < tags.length; i++) {
InvRadioButton jr = buttons[i];
configureButton(jr, tags[i]);
add(jr);
}
}
示例4: MetalThemeMenu
import javax.swing.ButtonGroup; //导入依赖的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);
}
}
}
示例5: 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;
}
示例6: buildViewMenu
import javax.swing.ButtonGroup; //导入依赖的package包/类
private void buildViewMenu() {
// --> View
JMenu menu = Utility.localizedMenu("menuBar.view");
menu.setOpaque(false);
menu.setMnemonic(KeyEvent.VK_V);
menu.add(getCheckBoxMenuItem(MapControlsAction.id));
menu.add(getCheckBoxMenuItem(DisplayGridAction.id));
menu.add(getCheckBoxMenuItem(ChangeWindowedModeAction.id));
menu.addSeparator();
ButtonGroup tileTextGroup = new ButtonGroup();
for (DisplayText type : DisplayText.values()) {
menu.add(getRadioButtonMenuItem(DisplayTileTextAction.id + type.getKey(),
tileTextGroup));
}
menu.addSeparator();
menu.add(getMenuItem(ZoomInAction.id));
menu.add(getMenuItem(ZoomOutAction.id));
add(menu);
}
示例7: getDefaultComponent
import javax.swing.ButtonGroup; //导入依赖的package包/类
public Component getDefaultComponent(Container aContainer) {
Component c = getFirstComponent(aContainer);
if (c instanceof AbstractButton) {
ButtonModel bm = ((AbstractButton)c).getModel();
if (bm instanceof DefaultButtonModel) {
ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
while (en != null && en.hasMoreElements()) {
AbstractButton ab = en.nextElement();
if (ab.isSelected()) return ab;
}
}
}
return c;
}
示例8: initRadioButtons
import javax.swing.ButtonGroup; //导入依赖的package包/类
private void initRadioButtons() {
applicationDescButtonModel = new ToggleButtonModel();
appletDescButtonModel = new ToggleButtonModel();
compDescButtonModel = new ToggleButtonModel();
bg = new ButtonGroup();
applicationDescButtonModel.setGroup(bg);
appletDescButtonModel.setGroup(bg);
compDescButtonModel.setGroup(bg);
String desc = evaluator.getProperty(JNLP_DESCRIPTOR);
if (desc != null) {
if (desc.equals(DescType.application.toString())) {
applicationDescButtonModel.setSelected(true);
} else if (desc.equals(DescType.applet.toString())) {
appletDescButtonModel.setSelected(true);
} else if (desc.equals(DescType.component.toString())) {
compDescButtonModel.setSelected(true);
}
} else {
applicationDescButtonModel.setSelected(true);
}
}
示例9: createTypeMenu
import javax.swing.ButtonGroup; //导入依赖的package包/类
/**
* @return menu that allows to select possible column types
*/
private JMenu createTypeMenu() {
ButtonGroup typeGroup = new ButtonGroup();
JMenu typeChangeItem = new JMenu(CHANGE_TYPE_LABEL);
typeChangeItem.setToolTipText(CHANGE_TYPE_TIP);
for (final ColumnType columnType : ColumnType.values()) {
final JCheckBoxMenuItem checkboxItem = new JCheckBoxMenuItem(
DataImportWizardUtils.getNameForColumnType(columnType));
if (columnType == metaData.getColumnMetaData(columnIndex).getType()) {
checkboxItem.setSelected(true);
}
checkboxItem.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
changeType(columnType);
}
}
});
typeGroup.add(checkboxItem);
typeChangeItem.add(checkboxItem);
}
return typeChangeItem;
}
示例10: updatePerspectives
import javax.swing.ButtonGroup; //导入依赖的package包/类
private void updatePerspectives(List<Perspective> perspectives) {
removeAll();
perspectiveMap.clear();
workspaceMenuGroup = new ButtonGroup();
for (Perspective p : perspectives) {
String name = p.getName();
Action action = new WorkspaceAction(PerspectiveMenu.this.perspectiveController, p, name);
if (p.isUserDefined()) {
action.putValue(Action.ACTION_COMMAND_KEY, "perspective-" + name);
action.putValue(Action.NAME, name);
ImageIcon createIcon = SwingTools
.createIcon("16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.workspace_user.icon"));
action.putValue(Action.LARGE_ICON_KEY, createIcon);
action.putValue(Action.SMALL_ICON, createIcon);
action.putValue(Action.SHORT_DESCRIPTION,
I18N.getMessage(I18N.getGUIBundle(), "gui.action.workspace_user.tip", name));
}
JMenuItem menuItem = new JRadioButtonMenuItem(action);
add(menuItem);
perspectiveMap.put(p.getName(), menuItem);
workspaceMenuGroup.add(menuItem);
}
if (perspectiveMap.containsKey(perspectiveName)) {
perspectiveMap.get(perspectiveName).setSelected(true);
}
}
示例11: getReplacemetPanel
import javax.swing.ButtonGroup; //导入依赖的package包/类
private Component getReplacemetPanel() {
JPanel group = new JPanel(new GridLayout(0, 1));
group.setBorder(BorderFactory.createTitledBorder(ResourceLoader
.getString("ArrowReplacementType.name")));
group.add(safe = new JRadioButton("ArrowReplacementType.safe"));
group.add(children = new JRadioButton("ArrowReplacementType.branching"));
group.add(all = new JRadioButton("ArrowReplacementType.everywhere"));
safe.setSelected(true);
ButtonGroup g = new ButtonGroup();
g.add(children);
g.add(all);
g.add(safe);
setReplaceEnable(false);
return group;
}
示例12: createButtons
import javax.swing.ButtonGroup; //导入依赖的package包/类
@Override
protected void createButtons(ButtonGroup group) {
JToggleButton button1 = createOpenViewButton(group, editorView);
button1.setSelected(true);
buttonsPanel.add(button1);
buttonsPanel.add(createOpenViewButton(group, htmlView));
Iterator<DocBookExporter> iterator = AdditionalPluginLoader
.loadProviders(DocBookExporter.class);
while (iterator.hasNext()) {
final DocBookExporter exporter = iterator.next();
JButton tb = new JButton();
tb.setText(exporter.getActionName());
tb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exporter.createReport(getFramework(),
new ReportLoadCallback() {
@Override
public InputStream getDocBookInputStream() {
// TODO Auto-generated method stub
return null;
}
});
}
});
buttonsPanel.add(tb);
}
}
示例13: 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 );
}
示例14: 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);
}
示例15: getPanel
import javax.swing.ButtonGroup; //导入依赖的package包/类
@Override
public IPanel getPanel(final int i) {
if ((i == 0) && (!modelTypeAdded)) {
ButtonGroup bg = new ButtonGroup();
idef0.setSelected(true);
bg.add(idef0);
bg.add(dfd);
bg.add(dfds);
JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
jPanel.add(idef0);
jPanel.add(dfd);
jPanel.add(dfds);
JPanel panel = (JPanel) super.getPanel(i);
panel.add(jPanel, BorderLayout.SOUTH);
modelTypeAdded = true;
}
if (super.getPanelCount() == i) {
return ouners;
}
return super.getPanel(i);
}