项目:incubator-netbeans
文件:RevertModifications.java
MoreCommitsRevertType (RepositoryFile repositoryFile,JRadioButton button) {
super(button);
startPath =
new RepositoryPaths(
repositoryFile,null,getPanel().startRevisionTextField,getPanel().startSearchButton
);
startPath.addPropertychangelistener(RevertModifications.this);
startPath.setupBehavior(null,SvnSearch.SEACRH_HELP_ID_REVERT);
endpath =
new RepositoryPaths(
repositoryFile,getPanel().endRevisionTextField,getPanel().endSearchButton
);
endpath.addPropertychangelistener(RevertModifications.this);
endpath.setupBehavior(null,SvnSearch.SEACRH_HELP_ID_REVERT);
}
项目:Equella
文件:DRMRightsTab.java
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,1,1));
addInner(selectable,1));
setSelected(false);
}
项目:incubator-netbeans
文件:AddServerInstanceWizard.java
static JRadioButton[] listAvailableProviders(String path) {
List<JRadioButton> res = new ArrayList<JRadioButton>();
for (Action a : Utilities.actionsForPath(path+"/Actions")) { // NOI18N
if (a == null) {
continue;
}
Object msg = a.getValue("wizardMessage"); // NOI18N
if (msg instanceof String) {
JRadioButton button = new JRadioButton((String)msg);
button.putClientProperty("action",a); // NOI18N
res.add(button);
}
}
return res.toArray(new JRadioButton[0]);
}
项目:ramus
文件:SectorNameEditor.java
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;
}
项目:incubator-netbeans
文件:ExtractInlinedStylePanel.java
private void setSectionMode(Mode mode) {
this.selection = mode;
JRadioButton select;
switch (selection) {
case refactorToExistingEmbeddedSection:
//select first existing css section if available
if(existingEmbeddedSectionsComboBox.getModel().getSize() > 1) { //first item is the 'create new section'
existingEmbeddedSectionsComboBox.setSelectedindex(1); //select second item,which is the first existing section
}
case refactorToNewEmbeddedSection:
select = embeddedSectionRB;
break;
case refactorToExistingExternalSheet:
case refactorToReferedExternalSheet:
case refactorToNewExternalSheet:
select = externalSheetRB;
break;
default:
throw new IllegalStateException();
}
select.setSelected(true);
}
项目:Equella
文件:AbstractChoiceDialog.java
public void addChoice(final String key,String displayText)
{
final JRadioButton rb = new JRadioButton(displayText);
if( doubleClickToSelect )
{
rb.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
if( e.getClickCount() >= 2 )
{
addClicked(key);
}
}
});
}
choices.addButton(rb,key);
// Add after the instructions label and any existing choices
add(rb,choices.size());
}
项目:rapidminer
文件:NewRepositoryDialog.java
@Override
protected void finish() {
try {
if (localButton.isSelected()) {
localRepositoryPanel.makeRepository();
} else {
// check all custom repository radio buttons
for (Pair<RepositoryConfigurationPanel,JRadioButton> value : repoConfigPanels.values()) {
// once we have found the selected radio button
if (value.getSecond().isSelected()) {
// lookup the corresponding factory and create the repository
value.getFirst().makeRepository();
}
}
}
super.finish();
} catch (RepositoryException e) {
SwingTools.showSimpleErrorMessage("cannot_create_repository",e);
}
}
项目:jiracli
文件:CredentialsPanel.java
private CredentialsPanel(String username,String url) {
this.url = url;
this.usernamePassword = new JRadioButton("Username and password");
this.usernamePassword.addActionListener(new RadioButtonListener());
this.anonymous = new JRadioButton("Anonymous access");
this.anonymous.addActionListener(new RadioButtonListener());
this.buttonGroup = new ButtonGroup();
this.buttonGroup.add(usernamePassword);
this.buttonGroup.add(anonymous);
this.usernameLabel = new JLabel("Username:");
this.username = new JTextField(Objects.toString(username,""),20);
this.passwordLabel = new JLabel("Password:");
this.password = new jpasswordfield(20);
if (username == null || username.isEmpty()) {
this.anonymous.setSelected(true);
} else {
this.usernamePassword.setSelected(true);
this.password.addAncestorListener(new RequestFocusListener());
}
radioButtonToggled();
layoutComponents();
}
/**
* Like createPane,but creates a pane with 2 columns of radio buttons. The
* number of buttons passed in *must* be even.
*/
private JPanel create2ColPane(String description,JRadioButton[] radioButtons,JButton showButton) {
JLabel label = new JLabel(description);
int numPerColumn = radioButtons.length / 2;
JPanel grid = new JPanel(new GridLayout(0,2));
for (int i = 0; i < numPerColumn; i++) {
grid.add(radioButtons[i]);
grid.add(radioButtons[i + numPerColumn]);
}
JPanel Box = new JPanel();
Box.setLayout(new BoxLayout(Box,BoxLayout.PAGE_AXIS));
Box.add(label);
grid.setAlignmentX(0.0f);
Box.add(grid);
JPanel pane = new JPanel(new BorderLayout());
pane.add(Box,BorderLayout.PAGE_START);
pane.add(showButton,BorderLayout.PAGE_END);
return pane;
}
项目:OrthancAnonymization
文件:AnonActionProfileListener.java
public AnonActionProfileListener(JComboBox<Object> anonProfiles,JLabel profileLabel,JRadioButton radioBodyCharac1,JRadioButton radioBodyCharac2,JRadioButton radioDates1,JRadioButton radioDates2,JRadioButton radioBd2,JRadioButton radioBd1,JRadioButton radioPt1,JRadioButton radioPt2,JRadioButton radioSc1,JRadioButton radioSc2,JRadioButton radioDesc1,JRadioButton radioDesc2){
this.profileLabel = profileLabel;
this.anonProfiles = anonProfiles;
this.radioBodyCharac1 = radioBodyCharac1;
this.radioBodyCharac2 = radioBodyCharac2;
this.radioDates1 = radioDates1;
this.radioDates2 = radioDates2;
this.radioBd2 = radioBd2;
this.radioBd1 = radioBd1;
this.radioPt1 = radioPt1;
this.radioPt2 = radioPt2;
this.radioSc1 = radioSc1;
this.radioSc2 = radioSc2;
this.radioDesc1 = radioDesc1;
this.radioDesc2 = radioDesc2;
}
项目:VASSAL-src
文件:WizardSupport.java
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;
}
项目:VASSAL-src
文件:WizardSupport.java
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;
}
项目:OpenDA
文件:Query.java
/** Set the current value in the entry with the given name.
* If the entry is not a checkBox,then throw an exception.
* Notify listeners that the value has changed.
* @exception NoSuchElementException If there is no item with the
* specified name. Note that this is a runtime exception,so it
* need not be declared explicitly.
* @exception IllegalArgumentException If the entry is not a
* checkBox. This is a runtime exception,so it
* need not be declared explicitly.
*/
public void setBoolean(String name,boolean value)
throws NoSuchElementException,IllegalArgumentException {
Object result = _entries.get(name);
if (result == null) {
throw new NoSuchElementException(
"No item named \"" + name + "\" in the query Box.");
}
if (result instanceof JRadioButton) {
((JRadioButton) result).setSelected(value);
} else {
throw new IllegalArgumentException(
"Item named \""
+ name
+ "\" is not a radio button,and hence does not have "
+ "a boolean value.");
}
_notifyListeners(name);
}
项目:Moenagade
文件:LayoutStyle.java
private Icon getIcon(AbstractButton button) {
Icon icon = button.getIcon();
if (icon != null) {
return icon;
}
String key = null;
if (button instanceof JCheckBox) {
key = "CheckBox.icon";
} else if (button instanceof JRadioButton) {
key = "RadioButton.icon";
}
if (key != null) {
Object oIcon = UIManager.get(key);
if (oIcon instanceof Icon) {
return (Icon)oIcon;
}
}
return null;
}
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);
}
项目:nativehtml
文件:SwingHtmlInputElement.java
public void setAttribute(String name,String value) {
if (name.equals("type") && !name.equals(getAttribute(name))) {
String text = getAttribute("value");
if ("checkBox".equalsIgnoreCase(value)) {
setComponent(new JCheckBox(text));
} else if ("submit".equalsIgnoreCase(value)) {
setComponent(new JButton(text == null ? "submit" : text));
} else if ("radio".equals(value)) {
setComponent(new JRadioButton(text));
}
}
if (name.equals("value")) {
if (component instanceof AbstractButton) {
((AbstractButton) component).setText(value);
} else if (component instanceof JTextField) {
((JTextField) component).setText(value);
}
}
super.setAttribute(name,value);
}
项目:Equella
文件:AccessEditor.java
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;
}
项目:incubator-netbeans
文件:Reset.java
项目:incubator-netbeans
文件:AvailableProvidersPanel.java
项目:brModelo
文件:conversorDrawer.java
public void Escreve(conversorOpcoes Opcoes) {
Grp = new javax.swing.ButtonGroup();
Opcoes.Textos.forEach(s -> {
JLabel lbl = new JLabel(s);
lbl.setFont(new Font(lbl.getFont().getName(),Font.BOLD,lbl.getFont().getSize()));
add(lbl);
});
add(new JLabel(" "));
Opcoes.Questoes.forEach(s -> {
JRadioButton rd = new JRadioButton(s);
rd.setopaque(false);
int i = listaRD.size();
Grp.add(rd);
listaRD.add(rd);
add(rd);
if (Opcoes.disables.indexOf(i) > -1) {
rd.setEnabled(false);
}
if (i == Opcoes.opcDefault) {
rd.setSelected(true);
}
});
if (Opcoes.Observacoes.size() > 0) {
add(new JLabel("Observação:"));
}
Opcoes.Observacoes.forEach(s -> {
add(new JLabel(s));
});
}
private static Icon getpressedIconSafe(JRadioButton radio) {
Icon icon = radio.getIcon();
if (icon == null) {
return getDefaultIcon();
}
Icon pressedIcon = radio.getpressedIcon();
if (pressedIcon == null) {
pressedIcon = radio.getSelectedIcon();
}
return (pressedIcon != null) ? pressedIcon : getIconSafe(radio);
}
private static Icon getRolloverSelectedIconSafe(JRadioButton radio) {
Icon icon = radio.getIcon();
if (icon == null) {
return getDefaultIcon();
}
Icon rolloverSelectedIcon = radio.getRolloverSelectedIcon();
if (rolloverSelectedIcon == null) {
rolloverSelectedIcon = radio.getSelectedIcon();
}
return (rolloverSelectedIcon != null) ? rolloverSelectedIcon : getIconSafe(radio);
}
项目:geomapapp
文件:MCSSave.java
public void save() {
JPanel panel = new JPanel( new GridLayout(0,1) );
JLabel label = new JLabel("Save/Download");
label.setForeground(Color.black);
panel.add( label );
ButtonGroup group = new ButtonGroup();
JRadioButton jpeg = new JRadioButton("JPEG image");
group.add(jpeg);
panel.add( jpeg);
JRadioButton segy = new JRadioButton("SEGY file");
group.add(segy);
panel.add( segy);
nav = new JRadioButton("CDP Navigation");
group.add(nav);
panel.add( nav);
JRadioButton history = new JRadioButton("processing history");
group.add(history);
panel.add( history);
jpeg.setSelected(true);
int ok = JOptionPane.showOptionDialog( image.getTopLevelAncestor(),panel,"cruise "+ image.getCruiseID() +",line "+ image.getID(),JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,null);
if( ok== JOptionPane.CANCEL_OPTION) return;
if( nav.isSelected() ||
segy.isSelected()
|| history.isSelected() )saveSegy(history.isSelected());
else saveJPEG();
}
项目:rapidminer
文件:SelectionDialog.java
/**
* Checks,if the specified radio button is selected.
*
* @param index
* Index of the radio button to examine
* @return true,if the radio button is selected
*/
public boolean isOptionSelected(int index) {
if (index >= selectionPanel.getComponents().length) {
return false;
}
JRadioButton radioButton = (JRadioButton) selectionPanel.getComponent(index);
if (radioButton.isSelected()) {
return true;
} else {
return false;
}
}
项目:Equella
文件:AbstractChoiceDialog.java
项目:jaer
文件:AbstractMultiBitRegisterCP.java
public void updateGUI() {
for (int i = 0; i < reg.fieldsNumber(); ++i) {
// if (reg.fieldNeedsUpdate(i))
if (controls[i] instanceof JRadioButton) {
((JRadioButton) controls[i]).setSelected(reg.getPartialValue(i) != 0);
}
else {
((JTextField) controls[i]).setText(Integer.toString(reg.getPartialValue(i)));
}
}
}
项目:openjdk-jdk10
文件:bug8041561.java
private static void createAndShowGUI() {
JFrame frame = new JFrame();
frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
frame.setBackground(Color.BLUE);
radioButton = new JRadioButton();
radioButton.setopaque(false);
JPanel panel = new JPanel();
panel.setBackground(Color.BLUE);
panel.add(radioButton);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
@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;
}
项目:VASSAL-src
文件:WizardSupport.java
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;
}
public DeviceButtonGroup(Controller controller,int cols) {
super(controller);
buttonGroup = new ButtonGroup();
buttons = new ArrayList<JRadioButton>();
buttonActions = new ArrayList<IAction>();
labelHash = new HashMap<String,Integer>();
this.cols = cols;
buttonPanel = new JPanel(new GridBagLayout());
}
项目:enigma-vk
文件:ClassMatchingGui.java
项目:OpenDA
文件:Query.java
/** Create an on-off check Box.
* @param name The name used to identify the entry (when calling get).
* @param label The label to attach to the entry.
* @param defaultValue The default value (true for on).
*/
public void addCheckBox(String name,String label,boolean defaultValue) {
JLabel lbl = new JLabel(label + ": ");
lbl.setBackground(_background);
JRadioButton checkBox = new JRadioButton();
checkBox.setBackground(_background);
checkBox.setopaque(false);
checkBox.setSelected(defaultValue);
_addPair(name,lbl,checkBox,checkBox);
// Add the listener last so that there is no notification
// of the first value.
checkBox.addItemListener(new QueryItemListener(name));
}
/**
* Adds a radio button with the given label,which (when selected) performs
* the given action.
*/
public JRadioButton addButton(String label,final IAction action) {
int id = buttons.size();
JRadioButton newButton = new JRadioButton(label);
buttons.add(newButton);
buttonGroup.add(newButton);
labelHash.put(label,id);
GridBagConstraints gbc1 = new GridBagConstraints();
gbc1.gridx = id % cols; gbc1.gridy = id/cols;
gbc1.gridwidth = 1;
buttonPanel.add(newButton,gbc1);
if (action != null) {
ActionListener buttonAction = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
try {
doAction(action);
}
catch (RuntimeException e) {
System.err.println(e+" "+e.getMessage());
}
}
};
newButton.addActionListener(buttonAction);
while (id > buttonActions.size()+1) {
buttonActions.add(null);
}
buttonActions.add(action);
}
return newButton;
}
项目:Moenagade
文件:LayoutStyle.java
/**
* Returns the amount to indent the specified component if it's
* a JCheckBox or JRadioButton. If the component is not a JCheckBox or
* JRadioButton,0 will be returned.
*/
int getButtonChildindent(JComponent c,int position) {
if ((c instanceof JRadioButton) || (c instanceof JCheckBox)) {
AbstractButton button = (AbstractButton)c;
Insets insets = c.getInsets();
Icon icon = getIcon(button);
int gap = button.getIconTextGap();
if (isLeftAligned(button,position)) {
return insets.left + icon.getIconWidth() + gap;
} else if (isRightAligned(button,position)) {
return insets.right + icon.getIconWidth() + gap;
}
}
return 0;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。