|
Flow Layout Manager The FlowLayout manager is the default layout manager for any user interface component. There are three ways to specify the FlowLayout manager:
To display a component on the window, call the method "add". Example In the code below, five buttons (with labels "1", "2", "3", "4", and "5") are created and displayed on the window with the FlowLayout manager. Run this applet and experiment with the size of the drawing area to better understand how the flow manager works. Remember that this code should be stored in a file called Flow.java! import java.awt.*; import java.applet.*; public class Flow extends Applet { public void init () { setLayout(new FlowLayout()); add ( new Button("1") ); add ( new Button("2") ); add ( new Button("3") ); add ( new Button("4") ); add ( new Button("5") ); } } What You'll See: |