import java.awt.*; import java.applet.*; public class ChangeFonts extends Applet { TextField textField; public void init() { textField = new TextField(3); add(textField); textField.setText("32"); } public void paint(Graphics g) { String s = textField.getText(); int height = Integer.parseInt(s); Font font = new Font("TimesRoman", Font.PLAIN, height); g.setFont(font); FontMetrics fontMetrics = g.getFontMetrics(font); height = fontMetrics.getHeight() + 40; g.drawString("Change the Font.", 20, height); } public boolean action(Event event, Object arg) { repaint(); return true; } }