Tuesday, March 13, 2007

Folicure While Pregnant

FlowLayout GridLayout

The FlowLayout is the simplest method of placing the components inside a Panel or JPanel in java. Each of the components of a panel found in FlowLayout are located from left to right as in a list, one after the other, jumping down when there is no space enough for that component. FlowLayout

belonging to java.awt, but also can be applied to swing, such as in this case to a JPanel.

An example of the use of the FlowLayout in a program to place three buttons on a panel. import javax.swing .*;
import java.awt .*;


class Example extends JFrame {
JButton first = new JButton ("First");
JButton previous = new JButton ("Previous") ;
 JButton next = new JButton ("Next"); 
JButton last = new JButton ("Last");

Example () {
/ / Add the format to FlowLayout This.setLayout
JFrame (new FlowLayout ());
/ / Add components add
(first);
add (above);
add (next);
add (last)

setTitle ("FlowLayout Example") ;
setSize (400.400);
setVisible (true);


} public static void main (String [] args) {
new Example ();
}}






0 comments:

Post a Comment