undefined
undefined
It uses the Javascript to prompt you for the string to be displayed
Javascript passes the input string to Java through HTML
The string you entered is displayed in the screen
Source
import java.applet.*;
import java.awt.*;
public class Applet11 extends Applet
{
Font f = new Font("TimesRoman",Font.BOLD,36);
String whatToSay;
public void init()
{
setBackground(Color.white);
}
public void paint(Graphics g)
{
g.setFont(f);
g.drawString(this.whatToSay, 100 , 25);
}
public void newText(String s)
{
this.whatToSay = s;
repaint();
}
}