Set JRadioButton text bold and italic

Source code below will show you, how to set JRadioButton text to bold and italic.

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


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

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

public class SetJRadioButtonTextBoldAndItalic
{
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 : Default radio button font
//Font Style : Bold And Italic
//Font Size : Default radio button font size
Font newRadioButtonFont=new Font(radioButton.getFont().getName(),Font.ITALIC+Font.BOLD,radioButton.getFont().getSize());

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

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

//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