*****************************************************************
COMPLETE SOURCE CODE FOR : SetJRadioButtonTextItalic.java
*****************************************************************
import javax.swing.JRadioButton;
import javax.swing.JFrame;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Font;
public class SetJRadioButtonTextItalic
{
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 : Italic
//Font Size : Default radio button font size
Font newRadioButtonFont=new Font(radioButton.getFont().getName(),Font.ITALIC,radioButton.getFont().getSize());
//Set JRadioButton font using new created font
radioButton.setFont(newRadioButtonFont);
//Create a window using JFrame with title ( Set JRadioButton text italic )
JFrame frame=new JFrame("Set JRadioButton text 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
*****************************************************************