Java Code Examples for javax.swing.JRadioButton#setBorder()

The following examples show how to use javax.swing.JRadioButton#setBorder() . 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: Utils.java    From iBioSim with Apache License 2.0 5 votes vote down vote up
public static JRadioButton makeRadioToolButton(URL icon, URL selectedIcon, String actionCommand, String tooltip, ActionListener listener, final ButtonGroup buttonGroup){
	final JRadioButton button = new JRadioButton();
	buttonGroup.add(button);
	Utils.setupButton(button, icon, selectedIcon, actionCommand, tooltip, listener);
	button.setBorder(BorderFactory.createRaisedBevelBorder());
	button.setBorderPainted(true);
	
	return button;
}
 
Example 2
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 3
Source File: ControlPanel.java    From gepard with MIT License 4 votes vote down vote up
private JRadioButton getCustomRadioButton(String caption) {
	JRadioButton ret = new JRadioButton(caption);
	ret.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	ret.setFont(MAIN_FONT);
	return ret;
}
 
Example 4
Source File: ConfigWindow.java    From rscplus with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Adds a preconfigured radio button to the specified container. Does not currently assign the
 * radio button to a group.
 *
 * @param text The text of the radio button
 * @param container The container to add the button to
 * @param leftIndent The amount of padding to add to the left of the radio button as an empty
 *     border argument.
 * @return The newly created JRadioButton
 */
private JRadioButton addRadioButton(String text, Container container, int leftIndent) {
  JRadioButton radioButton = new JRadioButton(text);
  radioButton.setAlignmentX(Component.LEFT_ALIGNMENT);
  radioButton.setBorder(BorderFactory.createEmptyBorder(0, leftIndent, 7, 5));
  container.add(radioButton);
  return radioButton;
}