javax.swing.JRadioButton Java Examples

The following examples show how to use javax.swing.JRadioButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LWCheckboxPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
CheckboxDelegate() {
    super();
    cb = new JCheckBox() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    rb = new JRadioButton() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    setLayout(null);
    setRadioButton(false);
    add(rb);
    add(cb);
}
 
Example #2
Source File: RToggleButtonTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public void selectRadioButtonNotSelected() throws InterruptedException {
    final LoggingRecorder lr = new LoggingRecorder();
    siw(new Runnable() {
        @Override
        public void run() {
            List<Component> comps = ComponentUtils.findComponents(JRadioButton.class, frame);
            JRadioButton button = (JRadioButton) comps.get(2);
            RToggleButton rButton = new RToggleButton(button, null, null, lr);
            button.setSelected(false);
            rButton.mouseEntered(null);
            button.setSelected(true);
            rButton.mouseClicked(null);
        }
    });
    Call call = lr.getCall();
    AssertJUnit.assertEquals("select", call.getFunction());
    AssertJUnit.assertEquals("true", call.getState());
}
 
Example #3
Source File: GenealogyExample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public GenealogyExample() {
    super(new BorderLayout());

    // Construct the panel with the toggle buttons.
    JRadioButton showDescendant = new JRadioButton("Show descendants", true);
    final JRadioButton showAncestor = new JRadioButton("Show ancestors");
    ButtonGroup bGroup = new ButtonGroup();
    bGroup.add(showDescendant);
    bGroup.add(showAncestor);
    showDescendant.addActionListener(this);
    showAncestor.addActionListener(this);
    showAncestor.setActionCommand(SHOW_ANCESTOR_CMD);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(showDescendant);
    buttonPanel.add(showAncestor);

    // Construct the tree.
    tree = new GenealogyTree(getGenealogyGraph());
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(200, 200));

    // Add everything to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(scrollPane, BorderLayout.CENTER);
}
 
Example #4
Source File: LWCheckboxPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
CheckboxDelegate() {
    super();
    cb = new JCheckBox() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    rb = new JRadioButton() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    setLayout(null);
    setRadioButton(false);
    add(rb);
    add(cb);
}
 
Example #5
Source File: ColorPanel.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this, i);
        Object object = this.spinners[i].getLabel();
        if (object instanceof JRadioButton) {
            JRadioButton button = (JRadioButton) object;
            button.setText(text);
            button.getAccessibleContext().setAccessibleDescription(text);
        }
        else if (object instanceof JLabel) {
            JLabel label = (JLabel) object;
            label.setText(text);
        }
        this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
 
Example #6
Source File: ButtonBuilders.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JButton.class.getName())) {
        return new JButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBox.class.getName())) {
        return new JCheckBoxBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButton.class.getName())) {
        return new JRadioButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JToggleButton.class.getName())) {
        return new JToggleButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBoxMenuItem.class.getName())) {
        return new JCheckBoxMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButtonMenuItem.class.getName())) {
        return new JRadioButtonMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenu.class.getName())) {
        return new JMenuBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuBar.class.getName())) {
        return new JMenuBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuItem.class.getName())) {
        return new JMenuItemBuilder(instance, heap);
    }
    return null;
}
 
Example #7
Source File: CasAnnotationViewer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the entity mode button.
 */
private void createEntityModeButton() {
  this.entityModeButton = new JRadioButton("Entities", this.viewMode == MODE_ENTITIES);
  this.entityModeButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      JRadioButton radioButton = (JRadioButton) e.getSource();
      if (!radioButton.isSelected() || viewMode == MODE_ENTITIES) {
        // If the radio button is unselected, there is no need to refresh the UI.
        // If the view mode is already entities view mode, there is no need to refresh the UI.
        return;
      }
      viewMode = MODE_ENTITIES;
      resetTabbedPane();
      display();
    }
  });
}
 
Example #8
Source File: ColorPanel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this, i);
        Object object = this.spinners[i].getLabel();
        if (object instanceof JRadioButton) {
            JRadioButton button = (JRadioButton) object;
            button.setText(text);
            button.getAccessibleContext().setAccessibleDescription(text);
        }
        else if (object instanceof JLabel) {
            JLabel label = (JLabel) object;
            label.setText(text);
        }
        this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
 
Example #9
Source File: SessionAnalysisWorkflowManagerSHRIMP.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
public void refreshView() {
    Enumeration buttons = includedFractions_buttonGroup.getElements();
    while (buttons.hasMoreElements()) {
        JRadioButton b = (JRadioButton) buttons.nextElement();
        if (b.isSelected()) {
            b.doClick();
            break;
        }
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).isSAVED_YAXIS_IS_UNIFORM()) {
        uniformYaxis.doClick();
    } else {
        independentYaxis.doClick();
    }

    if (((TripoliSessionRawDataView) tripoliSessionRawDataView).getSAVED_DATA_USED_FOR_SCALING().equals(IncludedTypeEnum.ALL)) {
        allDataUsedForScaling.doClick();
    } else {
        includedDataUsedForScaling.doClick();
    }

}
 
Example #10
Source File: JExtendedRadioButton.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void createExtraIcon() {
    JRadioButton reference = new JRadioButton();
    int iconTextGap = reference.getIconTextGap();

    Icon disabledIcon = getDisabledIconSafe(reference);
    Icon disabledSelectedIcon = getDisabledSelectedIconSafe(reference);
    Icon icon = getIconSafe(reference);
    Icon pressedIcon = getPressedIconSafe(reference);
    Icon rolloverIcon = getRolloverIconSafe(reference);
    Icon rolloverSelectedIcon = getRolloverSelectedIconSafe(reference);
    Icon selectedIcon = getSelectedIconSafe(reference);

    setDisabledIcon((disabledIcon == null) ? extraIcon : new DoubleIcon(disabledIcon, extraIcon, iconTextGap));
    setDisabledSelectedIcon((disabledSelectedIcon == null) ? extraIcon
                                                           : new DoubleIcon(disabledSelectedIcon, extraIcon, iconTextGap));
    setIcon((icon == null) ? extraIcon : new DoubleIcon(icon, extraIcon, iconTextGap));
    setPressedIcon((pressedIcon == null) ? extraIcon : new DoubleIcon(pressedIcon, extraIcon, iconTextGap));
    setRolloverIcon((rolloverIcon == null) ? extraIcon : new DoubleIcon(rolloverIcon, extraIcon, iconTextGap));
    setRolloverSelectedIcon((rolloverSelectedIcon == null) ? extraIcon
                                                           : new DoubleIcon(rolloverSelectedIcon, extraIcon, iconTextGap));
    setSelectedIcon((selectedIcon == null) ? extraIcon : new DoubleIcon(selectedIcon, extraIcon, iconTextGap));
}
 
Example #11
Source File: ColorPanel.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this, i);
        Object object = this.spinners[i].getLabel();
        if (object instanceof JRadioButton) {
            JRadioButton button = (JRadioButton) object;
            button.setText(text);
            button.getAccessibleContext().setAccessibleDescription(text);
        }
        else if (object instanceof JLabel) {
            JLabel label = (JLabel) object;
            label.setText(text);
        }
        this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
 
Example #12
Source File: NewRepositoryDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected String getNameForStep(int step) {
    switch (step) {
        case 0:
            if (repoConfigPanels.entrySet().isEmpty()) {
                return "local";
            } else {
                return "first";
            }
        case 1:
            // go through the custom radio buttons and return the key of the selected button
            for (Entry<String, Pair<RepositoryConfigurationPanel, JRadioButton>> entry : repoConfigPanels.entrySet()) {
                if (entry.getValue().getSecond().isSelected()) {
                    return entry.getKey();
                }
            }
        default:
            throw new IllegalArgumentException("Illegal index: " + step);
    }
}
 
Example #13
Source File: Query.java    From OpenDA with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** Get the current value in the entry with the given name
 *  and return as a boolean.  If the entry is not a checkbox,
 *  then throw an exception.
 *  @return The state of the checkbox.
 *  @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 boolean getBooleanValue(String name)
    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) {
        return ((JRadioButton) result).isSelected();
    } else {
        throw new IllegalArgumentException(
            "Item named \""
                + name
                + "\" is not a radio button, and hence does not have "
                + "a boolean value.");
    }
}
 
Example #14
Source File: JRadioButtonExample.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
   JFrame frame = new JFrame("JRadioButton Example");
   check = new JRadioButton("Check here ");
   check2 = new JRadioButton("Or check here");
   ButtonGroup bg = new ButtonGroup();
   bg.add(check);
   bg.add(check2);
   
   frame.getContentPane().add(check);
   frame.getContentPane().setLayout(new FlowLayout());
   frame.getContentPane().add(check2);
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setVisible(true);
   
   Thread.sleep(2000);
   bg.clearSelection();
}
 
Example #15
Source File: ExponentialFitFunctionView.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param exponentialFitFofX
 * @param parameterAValueSlider
 * @param parameterBValueSlider
 * @param parameterCValueSlider
 * @param functionChoiceRadioButton
 * @param bounds
 */
public ExponentialFitFunctionView (//
        AbstractFunctionOfX exponentialFitFofX,//
        ValueModelValueSlider parameterAValueSlider,//
        ValueModelValueSlider parameterBValueSlider,//
        ValueModelValueSlider parameterCValueSlider,//
        JRadioButton functionChoiceRadioButton,//
        Rectangle bounds ) {

    super( exponentialFitFofX, functionChoiceRadioButton, bounds );

    this.parameterAValueSlider = parameterAValueSlider;
    this.parameterBValueSlider = parameterBValueSlider;
    this.parameterCValueSlider = parameterCValueSlider;

}
 
Example #16
Source File: ColorPanel.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this, i);
        Object object = this.spinners[i].getLabel();
        if (object instanceof JRadioButton) {
            JRadioButton button = (JRadioButton) object;
            button.setText(text);
            button.getAccessibleContext().setAccessibleDescription(text);
        }
        else if (object instanceof JLabel) {
            JLabel label = (JLabel) object;
            label.setText(text);
        }
        this.spinners[i].setRange(this.model.getMinimum(i), this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
 
Example #17
Source File: ChartTableToggle.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
public ChartTableToggle(NMONVisualizerGui gui) {
    // border layout pads differently than the default flow layout
    // use it so the text for the radio buttons lines up with other text in the parent
    super(new BorderLayout());

    this.gui = gui;

    charts = new JRadioButton("Charts");
    table = new JRadioButton("Table");

    charts.setFont(Styles.LABEL);
    table.setFont(Styles.LABEL);

    charts.setBorder(Styles.CONTENT_BORDER);
    table.setBorder(Styles.CONTENT_BORDER);

    charts.setActionCommand("Charts");
    table.setActionCommand("Table");

    ActionListener toggle = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ChartTableToggle.this.gui.setProperty("chartsDisplayed", !e.getActionCommand().equals("Table"));
        }
    };

    charts.addActionListener(toggle);
    table.addActionListener(toggle);

    ButtonGroup group = new ButtonGroup();
    group.add(charts);
    group.add(table);

    charts.setSelected(true);
    table.setSelected(false);

    add(charts, BorderLayout.LINE_START);
    add(table, BorderLayout.LINE_END);

    gui.addPropertyChangeListener("chartsDisplayed", this);
}
 
Example #18
Source File: VideoIO.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
  * Adds a video engine type to the available choices.
  * 
  * @param type the video engine type
  */  
public void addVideoEngine(VideoType type) {
	JRadioButton button = new JRadioButton(type.getDescription());
	button.setActionCommand(type.getClass().getSimpleName());
	videoEngineButtonGroup.add(button);
	buttonMap.put(button, type);
	add(button);  		
}
 
Example #19
Source File: ImageRenderFunction.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Create a image according to the current state, simple and silly ...
 *
 * @param event the report event.
 */
public void pageStarted(final ReportEvent event)
{
  final BufferedImage image = new BufferedImage(150, 50, BufferedImage.TYPE_INT_ARGB);
  final Graphics2D g2 = image.createGraphics();
  final JButton bt = new JButton("A Button");
  bt.setSize(90, 20);
  final JRadioButton radio = new JRadioButton("A radio button");
  radio.setSize(100, 20);

  g2.setColor(Color.darkGray);
  bt.paint(g2);
  g2.setColor(Color.blue);
  g2.setTransform(AffineTransform.getTranslateInstance(20, 20));
  radio.paint(g2);
  g2.setTransform(AffineTransform.getTranslateInstance(0, 0));
  g2.setPaint(Color.green);
  g2.setFont(new Font("Serif", Font.PLAIN, 10));
  g2.drawString("You are viewing a graphics of JFreeReport on index "
      + event.getState().getCurrentRow(), 10, 10);
  g2.dispose();
  try
  {
    functionValue = new DefaultImageReference(image);
  }
  catch (IOException e)
  {
    functionValue = null;
  }
}
 
Example #20
Source File: BasicFormImpl.java    From PyramidShader with GNU General Public License v3.0 5 votes vote down vote up
public BasicFormImpl(Bindings bindings, JFileChooser fc) {
	bindings.add("outfile", _outfileField)
			.add("dontWrapJar", _dontWrapJarCheck)
			.add("jar", _jarField)
			.add("manifest", _manifestField)
			.add("icon", _iconField)
			.add("cmdLine", _cmdLineField)
			.add("errTitle", _errorTitleField)
			.add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL)
			.add("supportUrl", _supportUrlField)
			.add("chdir", _chdirField, ".")
			.add("priorityIndex", new JRadioButton[] { _normalPriorityRadio,
														_idlePriorityRadio,
														_highPriorityRadio })
			.add("stayAlive", _stayAliveCheck)
			.add("restartOnCrash", _restartOnCrashCheck);

	_dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener());

	_outfileButton.addActionListener(new BrowseActionListener(true, fc,
			new FileChooserFilter("Windows executables (.exe)", ".exe"),
			_outfileField));
	_jarButton.addActionListener(new BrowseActionListener(false, fc,
			new FileChooserFilter("Jar files", ".jar"), _jarField));
	_manifestButton.addActionListener(new BrowseActionListener(false, fc,
			new FileChooserFilter("Manifest files (.manifest)", ".manifest"),
			_manifestField));
	_iconButton.addActionListener(new BrowseActionListener(false, fc,
			new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField));
}
 
Example #21
Source File: DeploymentTable.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Component getTableCellEditorComponent(JTable table, Object value,
        boolean isSelected, int row, int column) {
    if (value == null)  return null;

    button = (JRadioButton) value;
    button.addItemListener(this);
    return (Component) value;
}
 
Example #22
Source File: XmlOptionPanelManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected int initSyntaxButton( int grid , TargetChooserPanel<FileType> panel, 
        TargetChooserPanelGUI<FileType> uiPanel ) 
{
    myXmlSyntaxButton = new javax.swing.JRadioButton();
    getJspSyntaxButton().setSelected(true);
    return grid;
}
 
Example #23
Source File: StockpileImportDialog.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
private void selected(JRadioButton jRadioButton, ImportReturn single, ImportReturn all) {
	if (jRadioButton.isSelected()) {
		if (jAll.isSelected()) {
			importReturn = all;
		} else {
			importReturn = single;
		}
	}
}
 
Example #24
Source File: ObjectViewerPanel.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public ObjectViewerPanel() {
	setLayout(new BorderLayout());
	textpane = new JTextArea();
	textpane.setLineWrap(true);
	textpane.setEditable(false);
	textpane.setWrapStyleWord(true);
	add(new JScrollPane(textpane),BorderLayout.CENTER);
	
	JPanel panel = new JPanel();
	add(panel, BorderLayout.NORTH);
	
	rdoJson = new JRadioButton("Json");
	rdoJson.setSelected(true);
	rdoMemory = new JRadioButton("Memory");		
	rdoBeanUtils = new JRadioButton("Bean");
	ButtonGroup group = new ButtonGroup();
				group.add(rdoJson);
				group.add(rdoMemory);
				group.add(rdoBeanUtils);
	panel.add(rdoJson);
	panel.add(rdoMemory);
	panel.add(rdoBeanUtils);
	
	rdoJson.addItemListener(il->show(currentObject));
	rdoMemory.addItemListener(il->show(currentObject));
	rdoBeanUtils.addItemListener(il->show(currentObject));
}
 
Example #25
Source File: Continuous1BandSwitcherForm.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
public Continuous1BandSwitcherForm(final ColorManipulationForm parentForm) {
    this.parentForm = parentForm;
    childForm = new EmptyImageInfoForm(parentForm);
    basicButton = new JRadioButton("Basic");
    graphicalButton = new JRadioButton("Sliders");
    tabularButton = new JRadioButton("Table");
    final ButtonGroup editorGroup = new ButtonGroup();
    editorGroup.add(basicButton);
    editorGroup.add(graphicalButton);
    editorGroup.add(tabularButton);
    graphicalButton.setSelected(true);
    final SwitcherActionListener switcherActionListener = new SwitcherActionListener();
    basicButton.addActionListener(switcherActionListener);
    graphicalButton.addActionListener(switcherActionListener);
    tabularButton.addActionListener(switcherActionListener);

    final JPanel editorSwitcherPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2));
    editorSwitcherPanel.add(new JLabel("Editor:"));
    editorSwitcherPanel.add(basicButton);
    editorSwitcherPanel.add(graphicalButton);
    editorSwitcherPanel.add(tabularButton);

    final JPanel northPanel = new JPanel(new BorderLayout(2, 2));
    northPanel.add(editorSwitcherPanel, BorderLayout.WEST);

    contentPanel = new JPanel(new BorderLayout());
    contentPanel.add(northPanel, BorderLayout.NORTH);
}
 
Example #26
Source File: StandaloneDeploymentTableModel.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public String getSelectedDeployment() {
    if (!hasDeployments()) return null;

    for (Enumeration e=deploymentsButtonGroup.getElements(); e.hasMoreElements();) {
        JRadioButton radio = (JRadioButton)e.nextElement();
        if (radio.getModel() == deploymentsButtonGroup.getSelection()) {
            return radio.getText();
        }
    }

    throw new IllegalStateException("No deployment selected");
}
 
Example #27
Source File: SchemaPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public RadioColumnEditor() {
	super();
	theRadioButton = new JRadioButton();
	theRadioButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent event) {
                                  fireEditingStopped();
		}
	});
}
 
Example #28
Source File: MeanFitFunctionView.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param meanFitFofX
 * @param parameterAValueSlider
 * @param functionChoiceRadioButton
 * @param bounds
 */
public MeanFitFunctionView (//
        AbstractFunctionOfX meanFitFofX,//
        ValueModelValueSlider parameterAValueSlider,//
        JRadioButton functionChoiceRadioButton,//
        Rectangle bounds ) {

    super( meanFitFofX, functionChoiceRadioButton, bounds );

    this.parameterAValueSlider = parameterAValueSlider;

}
 
Example #29
Source File: conversorDrawer.java    From brModelo with GNU General Public License v3.0 5 votes vote down vote up
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));
    });
}
 
Example #30
Source File: FileChooserEditor.java    From niftyeditor with Apache License 2.0 5 votes vote down vote up
private JPanel createAccessor(){
    JPanel result = new JPanel();
    BoxLayout layout = new BoxLayout(result, BoxLayout.Y_AXIS);
    result.setLayout(layout);
    absolute = new JRadioButton("Absolute path");
    relative = new JRadioButton("Relative to Assets folder");
    copy = new JRadioButton("Copy file in Assets folder");
    copy.addActionListener(this);
    JTextField absText = new JTextField();
    absText.setEditable(false);
    JTextField relText = new JTextField();
    relText.setEditable(false);
    copyText = new JTextField();
    copyText.setMaximumSize(new Dimension(400, 25));
    copyText.setEnabled(false);
    group = new ButtonGroup();
    group.add(copy);
    group.add(relative);
    group.add(absolute);
    absolute.setSelected(true);
    result.add(new ImagePreview(jFileChooser1));
    result.add(absolute);
    result.add(relative);
    result.add(copy);
    result.add(copyText);
    result.add(new JPanel());
    return result;
}