Hello Friends,
When I implemented JOptionPane in a simple program which is illustrated below, its working fine. But When I implemented it in an
applet it is giving me java.lang.ClassNotFound Exception. My question is, can we implement all of the Swing componeets in an applet (Are there any Swing components that can't be embedded in an applet). I have included the below code snippets for clarification.
----------- (Working :: SwingTest.java)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingTest1 {
public static void main(
String args[]) {
Frame f = new Frame("SwingTest1");
f.setSize(200,300);
f.setVisible(true);
JOptionPane.showMessageDialog(f, "There's no \"there\" there.");
}
}
-----------
------------ (not working :: SwingTest1Applet.java)
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingTest1Applet extends Applet {
public void init() {
Frame f = new Frame("SwingTest1");
f.setSize(200,300);
f.setVisible(true);
JOptionPane.showMessageDialog(f, "There's no \"there\" there.");
}
}
-------------
------------- ( testswingtest.html [SwingTest1Applet.class and testswingtest.html are in same directory] )
<applet code="SwingTest1Applet" width=200 height=300>
</applet>
-------------