************************************************************************
COMPLETE SOURCE CODE FOR : SetJTextAreaTextItalic.java
************************************************************************
import javax.swing.JTextArea;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.Font;
public class SetJTextAreaTextItalic
{
public static void main(String[]args)
{
//Create text area using JTextArea
JTextArea textArea=new JTextArea();
//Set line wrap to true
textArea.setLineWrap(true);
//Create font.
//Font Name : Default text area font
//Font Style : Italic
//Font Size : Default text area font size
Font newTextAreaFont=new Font(textArea.getFont().getName(),Font.ITALIC,textArea.getFont().getSize());
//Set JTextArea font using new created font
textArea.setFont(newTextAreaFont);
//Create a window using JFrame with title ( Set JTextArea text italic )
JFrame frame=new JFrame("Set JTextArea text italic");
//Set JFrame layout to BorderLayout
frame.setLayout(new BorderLayout());
//Add created text area into JFrame
frame.add(textArea);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
frame.setSize(400,500);
//Make JFrame visible
frame.setVisible(true);
}
}
************************************************************************
JUST COMPILE AND EXECUTE IT
************************************************************************