Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to run an applet

807600Jul 13 2007 — edited Jul 13 2007
I'm trying to run a applet but I get the error:
java.lang.ClassCastException: gui.Start cannot be cast to java.applet.Applet
(if this is important I'm using eclipse)

My code is (class Line extends JPanel)
import javax.swing.JFrame;
import java.awt.*;

public class Start {

	public static void main(String[] args) {
		JFrame window = new JFrame();
		window.setSize(100, 600);
		window.setTitle("Sliding Windows");
		
		Line la = new Line (0,0,60, 300, Color.blue);
		Container c = window.getContentPane();
		c.add(la);
		window.setVisible(true);

	}

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2007
Added on Jul 13 2007
6 comments
247 views