Java - Help.

Rhythmrocks

Disciple
I wrote a java program for the ScrollPanel swing. when I executed it, I got the following error:

appletviewer ScrollPaneDemo.java

java.lang.ClassCastException: ScrollPaneDemo cannot be cast to java.applet.Apple
t
at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
at sun.applet.AppletPanel.run(AppletPanel.java:361)
at java.lang.Thread.run(Thread.java:619)


Please help me in this
 
yep here is the code:

import java.awt.*;
import javax.swing.*;
import java.applet.*;

public class ScrollPaneDemo extends JFrame
{
public ScrollPaneDemo() {
super("JScrollPane Demo");
ImageIcon ii = new ImageIcon("earth.jpg");
JScrollPane jsp = new JScrollPane(new JLabel(ii));
getContentPane().add(jsp);
setSize(300,250);
setVisible(true);
}

public static void main(String[] args) {
new ScrollPaneDemo();
}
}

I gave the command : java ScrollPaneDemo.java

The Error I got was: Exception in thread "main" java.lang.NoClassDefFoundError: ScrollPaneDemo/java
 
Back
Top