Set JRadioButton text font

Source code below will show you, how to set JRadioButton text font.

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


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

import java.awt.BorderLayout;
import java.awt.Font;

public class SetJRadioButtonTextFont
{
public static void main(String[]args)
{
//Create radio button using JRadioButton with text ( I am a radio button )
JRadioButton radioButton=new JRadioButton("I am a radio button");

//Create font.
//Font Name : Tahoma
//Font Style : Default radio button font style
//Font Size : Default radio button font size
Font newRadioButtonFont=new Font("Tahoma",radioButton.getFont().getStyle(),radioButton.getFont().getSize());

//Set JRadioButton font using new created font
radioButton.setFont(newRadioButtonFont);

//Create a window using JFrame with title ( Set JRadioButton text font )
JFrame frame=new JFrame("Set JRadioButton text font");

//Set JFrame layout to BorderLayout
frame.setLayout(new BorderLayout());

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

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


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

RELAXING NATURE VIDEO