My doubt is how to run applet ..My code is as follows: The following code complied successfully .......To see the output whether i hav 2 type it in browser or dos prompt itself.. If i gave java SampleButton while Running in dos prompt, Its giving error called exception in thread "main" java.lang.noclassDefFoundError: SampleButton/Html
.
How to see its output in browser.
Thank u ....
import java.awt.*;
import java.applet.*;
public class SampleButton extends Applet {
java.awt.Button button1;
int presses = 0;
public void init() {
add( button1 = new java.awt.Button("Sample Button") );
}
public boolean handleEvent(Event event) {
if (event.target == button1
&& event.id == Event.ACTION_EVENT
){
Button_Clicked(event);
return true;
}
return super.handleEvent(event);
}
void Button_Clicked(Event event) {
System.out.println("Sample Button presses == " + ++presses);
showStatus( "Sample Button presses == " + presses);
}
}