Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

JRadioButton not select at start (Java)

Complete source code below will show you, how to make JRadioButton not select at start.

***********************************************************************
COMPLETE SOURCE CODE FOR : RadioButtonNotSelectAtStart.java
***********************************************************************
import javax.swing.JRadioButton;
import javax.swing.JFrame;

import java.awt.FlowLayout;

public class RadioButtonNotSelectAtStart
{
public static void main(String[]args)
{
 //Create radio button with not select at start
 //You can make this radio button select on start by change false to true
 JRadioButton radioButton=new JRadioButton("I am a radio button",false);

 //Create a window using JFrame with title ( JRadioButton not select on start )
 JFrame frame=new JFrame("JRadioButton not select on start");

 //Set JFrame layout
 frame.setLayout(new FlowLayout());

 //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(200,65);

 //Make JFrame visible
 frame.setVisible(true);
}
}


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