setFont 方法 import javax.swing.*; import java.awt.*;public class T extends JFrame { TextArea ta = new TextArea(10,20); public T () { ta.setFont(new Font("Serif",Font.BOLD|Font.ITALIC,20)); getContentPane().add(ta); setSize(450,500); setVisible(true); } public static void main(String[] args) throws Exception { T app = new T(); app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
import javax.swing.*;
import java.awt.*;public class T extends JFrame
{
TextArea ta = new TextArea(10,20);
public T ()
{ ta.setFont(new Font("Serif",Font.BOLD|Font.ITALIC,20));
getContentPane().add(ta);
setSize(450,500);
setVisible(true);
}
public static void main(String[] args) throws Exception
{
T app = new T();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}