|
|
|
|
|
|
FlowLayout HelpHelp is available for each task, or you can go straight to the FlowLayout source code to see a solution.
import java.awt.*; public class FlowLayoutTest extends java.applet.Applet { public void init() { setLayout(new FlowLayout()); } } Note the import statement because you are going to be using a number of classes from the AWT later on. Task 2Add five Buttons to the Applet.
public void init() { setLayout(new FlowLayout()); Button button1 = new Button("First"); add(button1); Button button2 = new Button("Second"); add(button2); Button button3 = new Button("Third"); add(button3); Button button4 = new Button("Fourth"); add(button4); Button button5 = new Button("Fifth"); add(button5); } |