import java.awt.*; import javax.swing.*; public class FontTest extends JFrame{ // JFrame frame = new JFrame(); Font a = new Font("Times New Roman", Font.BOLD, 38); Font b = new Font("Century Gothic", Font.ITALIC, 22); Font c = new Font("Arial", Font.PLAIN, 30); String string_01 = "This is a String"; String string_02 = "This is a String"; public FontTest(){ // frame.setTitle("FontTest"); setSize(490,350); // frame.setSize(490,350); setVisible( true ); //frame.setSize(490,350); } public void paint(Graphics g) { g.setFont(a); g.drawString( string_01, 50, 100); g.setFont(b); g.drawString( string_01, 50, 125); g.setColor(Color.red); g.setFont(c); g.drawString( string_01, 50, 155); } public static void main(String[] args) { FontTest ft = new FontTest(); } }