本文整理汇总了Java中javax.swing.JRadioButton.getPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JRadioButton.getPreferredSize方法的具体用法?Java JRadioButton.getPreferredSize怎么用?Java JRadioButton.getPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JRadioButton
的用法示例。
在下文中一共展示了JRadioButton.getPreferredSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SectorPanel
import javax.swing.JRadioButton; //导入方法依赖的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);
}
示例2: AttributionPanel
import javax.swing.JRadioButton; //导入方法依赖的package包/类
public AttributionPanel()
{
super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.attribution"), false); //$NON-NLS-1$
required = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.require"), true); //$NON-NLS-1$
selectable = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.selects")); //$NON-NLS-1$
enforce = new JCheckBox(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.enforce"), true); //$NON-NLS-1$
ButtonGroup group = new ButtonGroup();
group.add(required);
group.add(selectable);
final int height = required.getPreferredSize().height;
final int[] rows = {height, height, height,};
final int[] cols = {TableLayout.FILL,};
setInnerLayout(new TableLayout(rows, cols, 5, 5));
addInner(required, new Rectangle(0, 0, 1, 1));
addInner(selectable, new Rectangle(0, 1, 1, 1));
addInner(enforce, new Rectangle(0, 2, 1, 1));
setSelected(false);
}
示例3: generateDefaultDate
import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JComponent generateDefaultDate()
{
defaultButtons = new ButtonGroup();
defaultGroup = new JGroup(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.calendareditor.defaultdate"));
dateButton = new JRadioButton();
todayButton = new JRadioButton();
defaultButtons.add(todayButton);
defaultButtons.add(dateButton);
dateButton.setSelected(true);
dayCombo = new JComboBox(getDayNames());
dateSelector = new DateSelector();
final int width1 = todayButton.getPreferredSize().width;
final int height1 = dateSelector.getPreferredSize().height;
final int height2 = title.getPreferredSize().height;
final int[] rows = {height1, height2};
final int[] cols = {width1, TableLayout.FILL, TableLayout.DOUBLE_FILL};
defaultGroup.setInnerLayout(new TableLayout(rows, cols, 5, 5));
int row = -1;
defaultGroup.addInner(dateButton, new Rectangle(0, ++row, 1, 1));
defaultGroup.addInner(dateSelector, new Rectangle(1, row, 2, 1));
defaultGroup.addInner(todayButton, new Rectangle(0, ++row, 1, 1));
defaultGroup.addInner(dayCombo, new Rectangle(1, row, 1, 1));
defaultGroup.setSelected(false);
return defaultGroup;
}
示例4: AcceptancePanel
import javax.swing.JRadioButton; //导入方法依赖的package包/类
public AcceptancePanel()
{
super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.acceptance"), false); //$NON-NLS-1$
JLabel termsLabel = new JLabel(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.terms")); //$NON-NLS-1$
required = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.requireall"), true); //$NON-NLS-1$
selectable = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmrightstab.allow")); //$NON-NLS-1$
ButtonGroup group = new ButtonGroup();
group.add(required);
group.add(selectable);
required.addActionListener(this);
selectable.addActionListener(this);
terms = new JTextArea();
terms.setWrapStyleWord(true);
terms.setLineWrap(true);
JScrollPane termsScroll = new JScrollPane(terms);
final int height1 = required.getPreferredSize().height;
final int height2 = termsLabel.getPreferredSize().height;
final int height3 = height1 * 6;
final int[] rows = {height1, height2, height3, height1};
final int[] cols = {15, TableLayout.FILL};
setInnerLayout(new TableLayout(rows, cols, 5, 5));
addInner(required, new Rectangle(0, 0, 2, 1));
addInner(termsLabel, new Rectangle(1, 1, 1, 1));
addInner(termsScroll, new Rectangle(1, 2, 1, 1));
addInner(selectable, new Rectangle(0, 3, 2, 1));
setSelected(false);
}
示例5: generateControl
import javax.swing.JRadioButton; //导入方法依赖的package包/类
@Override
public JComponent generateControl()
{
localhost = new JRadioButton("This machine", true);
remotehost = new JRadioButton("A different server");
field = new JTextField();
ButtonGroup group = new ButtonGroup();
group.add(localhost);
group.add(remotehost);
ActionListener buttonListener = new ActionListener()
{
/*
* (non-Javadoc)
* @see
* java.awt.event.ActionListener#actionPerformed(java.awt.event.
* ActionEvent)
*/
@Override
public void actionPerformed(ActionEvent e)
{
update();
}
};
localhost.addActionListener(buttonListener);
remotehost.addActionListener(buttonListener);
final int height1 = field.getPreferredSize().height;
final int width1 = remotehost.getPreferredSize().width;
final int[] rows = {height1, height1,};
final int[] cols = {width1, TableLayout.FILL};
JPanel all = new JPanel(new TableLayout(rows, cols));
all.add(localhost, new Rectangle(0, 0, 2, 1));
all.add(remotehost, new Rectangle(0, 1, 1, 1));
all.add(field, new Rectangle(1, 1, 1, 1));
if( items.size() >= 1 )
{
String host = ((Item) items.get(0)).getValue();
if( host.length() == 0 || isLocalhost(host) )
{
localhost.setSelected(true);
}
else
{
remotehost.setSelected(true);
field.setText(host);
}
}
update();
return all;
}
示例6: setupGUI
import javax.swing.JRadioButton; //导入方法依赖的package包/类
private void setupGUI()
{
ipAddressRadio = new JRadioButton(CurrentLocale.get("com.tle.admin.recipients.ipaddressfinder.addip"), true);
referrerRadio = new JRadioButton(CurrentLocale.get("com.tle.admin.recipients.ipaddressfinder.addreferrer"));
ipAddressRadio.addActionListener(this);
referrerRadio.addActionListener(this);
ButtonGroup group1 = new ButtonGroup();
group1.add(ipAddressRadio);
group1.add(referrerRadio);
ipAddress = new IpAddressEditor();
referrerField = new JTextField();
referrerField.addKeyListener(new KeyAdapter()
{
@Override
public void keyTyped(KeyEvent e)
{
fireEvent();
}
});
referrerExact = new JRadioButton(CurrentLocale.get("com.tle.admin.recipients.ipaddressfinder.onlymatch"), true);
referrerPartial = new JRadioButton(CurrentLocale.get("com.tle.admin.recipients.ipaddressfinder.match"));
referrerExact.addActionListener(this);
referrerPartial.addActionListener(this);
ButtonGroup group2 = new ButtonGroup();
group2.add(referrerExact);
group2.add(referrerPartial);
final int height1 = ipAddressRadio.getPreferredSize().height;
final int height2 = ipAddress.getPreferredSize().height;
final int height3 = referrerField.getPreferredSize().height;
final int[] rows = {height1, height2, height1, height3, height3, height3, TableLayout.FILL,};
final int[] cols = {25, TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(ipAddressRadio, new Rectangle(0, 0, 2, 1));
add(ipAddress, new Rectangle(1, 1, 1, 1));
add(referrerRadio, new Rectangle(0, 2, 2, 1));
add(referrerField, new Rectangle(1, 3, 1, 1));
add(referrerExact, new Rectangle(1, 4, 1, 1));
add(referrerPartial, new Rectangle(1, 5, 1, 1));
updateGui();
}
示例7: createDetails
import javax.swing.JRadioButton; //导入方法依赖的package包/类
private JComponent createDetails()
{
JLabel titleLabel = new JLabel(CurrentLocale.get("wizard.controls.title"));
JLabel descriptionLabel = new JLabel(CurrentLocale.get("wizard.controls.description"));
title = new I18nTextField(BundleCache.getLanguages());
description = new I18nTextField(BundleCache.getLanguages());
JComponent dateSelection = generateDefaultDate();
formatGroup = new ButtonGroup();
JLabel formatLabel = new JLabel(getString("date.format"));
dayMonthYear = new JRadioButton(getDateString("full"));
formatGroup.add(dayMonthYear);
monthYear = new JRadioButton(getDateString("month"));
formatGroup.add(monthYear);
year = new JRadioButton(getDateString("year"));
formatGroup.add(year);
dayMonthYear.setSelected(true);// default
mandatory = new JCheckBox(CurrentLocale.get("wizard.controls.mandatory"));
reload = new JCheckBox(CurrentLocale.get("wizard.controls.reload"));
reload.addActionListener(new ReloadHandler(reload));
final int width1 = formatLabel.getPreferredSize().width;
final int height1 = title.getPreferredSize().height;
final int height2 = dateSelection.getPreferredSize().height;
final int height3 = dayMonthYear.getPreferredSize().height;
final int[] rows = {height1, height1, height2, height1, height3, height3, height3, height1, height1,
TableLayout.PREFERRED,};
final int[] cols = {width1, TableLayout.FILL,};
JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
int row = -1;
all.add(titleLabel, new Rectangle(0, ++row, 1, 1));
all.add(title, new Rectangle(1, row, 1, 1));
all.add(descriptionLabel, new Rectangle(0, ++row, 1, 1));
all.add(description, new Rectangle(1, row, 1, 1));
all.add(dateSelection, new Rectangle(0, ++row, 2, 1));
// TODO: format so it doesn't look so ugly
all.add(formatLabel, new Rectangle(0, ++row, 1, 1));
all.add(dayMonthYear, new Rectangle(1, ++row, 1, 1));
all.add(monthYear, new Rectangle(1, ++row, 1, 1));
all.add(year, new Rectangle(1, ++row, 1, 1));
all.add(mandatory, new Rectangle(0, ++row, 2, 1));
all.add(reload, new Rectangle(0, ++row, 2, 1));
if( getWizardType() != WizardHelper.WIZARD_TYPE_POWERSEARCH )
{
range = new JCheckBox(CurrentLocale.get("wizard.controls.timerange"));
all.add(range, new Rectangle(0, ++row, 2, 1));
}
return all;
}
示例8: AccessCountPanel
import javax.swing.JRadioButton; //导入方法依赖的package包/类
public AccessCountPanel()
{
super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.restrictaccesses"), //$NON-NLS-1$
false);
JLabel accessesLabel = new JLabel(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.number")); //$NON-NLS-1$
selectable = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.numberspecified"), //$NON-NLS-1$
true);
fixed = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.specifyfixed")); //$NON-NLS-1$
initial = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.specifydefault")); //$NON-NLS-1$
ButtonGroup group = new ButtonGroup();
group.add(selectable);
group.add(fixed);
group.add(initial);
selectable.addActionListener(this);
fixed.addActionListener(this);
initial.addActionListener(this);
accessesModel = new SpinnerNumberModel(100, 0, 1000000, 1);
accesses = new JSpinner(accessesModel);
final int height1 = selectable.getPreferredSize().height;
final int height2 = accesses.getPreferredSize().height;
final int width1 = accessesLabel.getPreferredSize().width;
final int width2 = accesses.getPreferredSize().width;
final int[] rows = {height1, height1, height1, height2};
final int[] cols = {15, width1, width2, TableLayout.FILL};
setInnerLayout(new TableLayout(rows, cols, 5, 5));
addInner(selectable, new Rectangle(0, 0, 4, 1));
addInner(fixed, new Rectangle(0, 1, 4, 1));
addInner(initial, new Rectangle(0, 2, 4, 1));
addInner(accessesLabel, new Rectangle(1, 3, 1, 1));
addInner(accesses, new Rectangle(2, 3, 1, 1));
setSelected(false);
}
示例9: DatePanel
import javax.swing.JRadioButton; //导入方法依赖的package包/类
public DatePanel()
{
super(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.restrictdate"), //$NON-NLS-1$
false);
JLabel startLabel = new JLabel(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.start")); //$NON-NLS-1$
JLabel endLabel = new JLabel(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.end")); //$NON-NLS-1$
endLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
fixed = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.specifyvalid"), //$NON-NLS-1$
true);
selectable = new JRadioButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.daterange")); //$NON-NLS-1$
ButtonGroup group = new ButtonGroup();
group.add(fixed);
group.add(selectable);
fixed.addActionListener(this);
selectable.addActionListener(this);
startField = new JTextField();
endField = new JTextField();
startField.setEditable(false);
endField.setEditable(false);
startSelect = new JButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.select")); //$NON-NLS-1$
endSelect = new JButton(
CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drm.drmacccesscontroltab.select")); //$NON-NLS-1$
startSelect.addActionListener(this);
endSelect.addActionListener(this);
final int height1 = fixed.getPreferredSize().height;
final int height2 = startField.getPreferredSize().height;
final int width1 = startLabel.getPreferredSize().width;
final int width2 = startSelect.getPreferredSize().width;
final int[] rows = {height1, height2, height2, height1,};
final int[] cols = {15, width1, width2 * 3, width2,};
setInnerLayout(new TableLayout(rows, cols, 5, 5));
addInner(fixed, new Rectangle(0, 0, 4, 1));
addInner(startLabel, new Rectangle(1, 1, 1, 1));
addInner(startField, new Rectangle(2, 1, 1, 1));
addInner(startSelect, new Rectangle(3, 1, 1, 1));
addInner(endLabel, new Rectangle(1, 2, 1, 1));
addInner(endField, new Rectangle(2, 2, 1, 1));
addInner(endSelect, new Rectangle(3, 2, 1, 1));
addInner(selectable, new Rectangle(0, 3, 4, 1));
setSelected(false);
}