package labeltest; import java.awt.*; import javax.swing.*; public class FontTest2 { 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 FontTest2(){ frame.setSize(490,350); frame.setVisible( true ); } 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) { FontTest2 ft = new FontTest2(); } }