Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;
import javax.swing.AbstractButton;

import javax.swing.ButtonGroup;

public class Main {
    /**
     * Creates a {@link ButtonGroup} and adds all the given buttons to it.
     * @param buttons the buttons to group
     * @return the created ButtonGroup
     */
    public static ButtonGroup group(AbstractButton... buttons) {
        final ButtonGroup group = new ButtonGroup();
        Arrays.stream(buttons).forEach(group::add);
        return group;
    }
}