Create radio button using JRadioButton

Source code below will show you, how to create a radio button in java with text HI using JRadioButton.

************************************************************************
COMPLETE SOURCE CODE FOR : CreateRadioButtonUsingJRadioButton.java
************************************************************************


import javax.swing.JRadioButton;
import javax.swing.JFrame;

public class CreateRadioButtonUsingJRadioButton
{
public static void main(String[]args)
{
//Create radio button with text HI
JRadioButton radioButton=new JRadioButton("HI");

//Create JFrame to place created JRadioButton
JFrame frame=new JFrame("Create radio button using JRadioButton");

//add created radio button into JFrame
frame.add(radioButton);

//set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//set JFrame size
frame.setSize(450,65);

//make your JFrame visible. So we can see it
frame.setVisible(true);
}
}


************************************************************************
JUST COMPILE AND EXECUTE IT
************************************************************************

RELAXING NATURE VIDEO