Back to Applets page
Click in the boxes below, select all and copy to grab the applet
HTML listing:
<HTML> <HEAD> <TITLE>Listing 9.3</TITLE> </HEAD> <BODY BGCOLOR=WHITE> <APPLET CODEBASE="classes" CODE="Applet3.class" WIDTH=400 HEIGHT=150> </APPLET> </BODY> </HTML>
Applet listing:
import java.awt.*; import java.applet.*; public class Applet3 extends Applet { public void init() { String spaces = " ",buttonText; setBackground(Color.white); this.setLayout(new FlowLayout(FlowLayout.RIGHT,35,5)); for (int i=1; i<=10; i++) { buttonText = spaces.substring(1,i) + "Button #" + i + spaces.substring(1,i); this.add(new Button(buttonText)); } } }