Tuesday, November 4, 2008
ComponentApplet
import java.applet.*;
import java.awt.*;
public class ComponentApplet extends Applet {
TextField text = new TextField("Green and Italic text field");
Button button1= new Button("red Foreground");
Button button2= new Button("cyan Background");
public void init() {
text.setBackground(Color.green);
text.setFont(new Font("Arial", Font.ITALIC, 12));
button1.setForeground(Color.red);
button2.setBackground(Color.cyan);
add(text);
add(button1);
add(button2);
}
}