Avatar of bdiddy05
bdiddy05

asked on 

Swing Applet Problem

I am writing a swing applet that displays a name in a number of different fonts, it compiles okay but when I try to run it a get the error message "exception in thread main java.lang.nosuchmethoderror"
import javax.swing.*;
	import java.awt.*;
	public class JFontSizeDemo extends JApplet
	{
	    Container myCon = getContentPane();
	    public void init()
	    {
	        myCon.setLayout(new FlowLayout());
	    }
	    public void paint(Graphics g)
	    {
	        int y = 0;
 
	        for(int i = 4; i <= 24; i += 2)
	        {
	            Font myFont = new Font("Serif", Font.PLAIN, i);
	            g.setFont(myFont);
	            g.drawString("Reggie Bush", y, 0);
	            y += g.getFontMetrics().getHeight();
 
	        }
	    }
	}

Open in new window

Java

Avatar of undefined
Last Comment
bdiddy05

8/22/2022 - Mon