
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;


public class Demo extends JPanel 
                                                                implements ActionListener {
        
        //Create a set of private reusable variables
        private String MIT = "MIT License";
        private String GPL = "GNU General Public License";
        private String WTFPL = "Do What The Fuck You Want To Public License";
        
        
        
        public Demo () {
                        super(new BorderLayout()); //I have no idea what this does
                        
                        //Create a MIT option
                        JRadioButton MITbutton = new JRadioButton(MIT);
                MITbutton.setActionCommand(MIT);
                MITbutton.setSelected(true); //Since it is the first one, choose it by default
                
                //Create a GPL option
                        JRadioButton GPLbutton = new JRadioButton(GPL);
                GPLbutton.setActionCommand(GPL);
                
                //Create a WTFPL option
                        JRadioButton WTFPLbutton = new JRadioButton(WTFPL);
                WTFPLbutton.setActionCommand(WTFPL);
                        
                        //Group the buttons
                ButtonGroup group = new ButtonGroup();
                group.add(MITbutton);
            group.add(GPLbutton);
                group.add(WTFPLbutton);
                
                //create Action Listeners
                MITbutton.addActionListener(this);
                GPLbutton.addActionListener(this);
                WTFPLbutton.addActionListener(this);
                
                //Create a Panel with a grid to house the radio buttons
                JPanel radioPanel = new JPanel(new GridLayout(0, 1));
                radioPanel.add(MITbutton);
                radioPanel.add(GPLbutton);
                radioPanel.add(WTFPLbutton);
                add(radioPanel, BorderLayout.LINE_START);
                
        }
          private static void GUI(){
                  //Create the frame aka window
                  JFrame NewWindow = new JFrame("Choose a Licence");
                  NewWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  
                  //create a place to hold the buttons in the window
                  JComponent ContentJar = new Demo();
                  ContentJar.setOpaque(true);
                  NewWindow.setContentPane(ContentJar);
                  
                  //Turn GUI on
                  NewWindow.pack();
                  NewWindow.setVisible(true);
                  
          }
          
          public static void main (String[] args){
                  javax.swing.SwingUtilities.invokeLater(new Runnable() {
                          public void run(){
                                  GUI();
                          }
                  });
          }
          
        @Override
        public void actionPerformed(ActionEvent arg0) {
                // TODO Auto-generated method stub
                
        }
        }