Example usage for javax.swing JRadioButton setBorder

List of usage examples for javax.swing JRadioButton setBorder

Introduction

In this page you can find the example usage for javax.swing JRadioButton setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildTroubleshootingPanel() {
    final JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    ActionListener levelChange = new ActionListener() {
        @Override//from w w w .  j  a  v a  2  s.  c om
        public void actionPerformed(ActionEvent e) {
            Level x = Level.parse(e.getActionCommand());
            if (Level.OFF.equals(x) || Level.INFO.equals(x) || Level.WARNING.equals(x)
                    || Level.SEVERE.equals(x))
                log.setLevel(x);
        }
    };
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new GridLayout(0, 1));
    logPanel.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
            CopiedFromOtherJars.getText("msg.logDetailPanel.border"))); //$NON-NLS-1$
    logPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    ButtonGroup logGroup = new ButtonGroup();
    for (Level type : new Level[] { Level.OFF, Level.INFO, Level.WARNING, Level.SEVERE }) {
        JRadioButton jrb = new JRadioButton(type.toString());
        jrb.setActionCommand(type.toString());
        jrb.addActionListener(levelChange);
        jrb.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), jrb.getBorder()));
        logPanel.add(jrb);
        logGroup.add(jrb);
        if (type == Level.WARNING) {
            jrb.setSelected(true);
            log.setLevel(type);
        }
    }
    jcbEnableAssertions.setAlignmentX(Component.LEFT_ALIGNMENT);
    jcbEnableAssertions.setText(CopiedFromOtherJars.getText("msg.info.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (!extraArgs.contains(ASSERTIONS_OPTION)) {
                    extraArgs = (ASSERTIONS_OPTION + " " + extraArgs); //$NON-NLS-1$
                }
            } else if (e.getStateChange() == ItemEvent.DESELECTED) {
                extraArgs = extraArgs.replace(ASSERTIONS_OPTION, ""); //$NON-NLS-1$
            }
            extraArgs = extraArgs.trim();
            jtfArgs.setText(extraArgs);
            updateCommand();
        }
    });
    p.add(logPanel, BorderLayout.NORTH);
    Box other = new Box(BoxLayout.PAGE_AXIS);
    other.add(jcbEnableAssertions);
    other.add(Box.createVerticalGlue());
    p.add(other, BorderLayout.CENTER);
    return p;
}