Monday, April 16, 2007

FlowLayout

import javax.swing.*;
import java.awt.*;
public class FlowLayoutTest extends JFrame{
public static void main(String[] args){
FlowLayoutTest flowlayout = new FlowLayoutTest();
flowlayout.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
flowlayout.setSize(400,300);
flowlayout.setVisible(true);
}
public FlowLayoutTest(){
super("FlowLayout Manager");
Container pane = getContentPane();
pane.setLayout(new FlowLayout(FlowLayout.LEFT));
pane.add(new JLabel("This is a flowlayout test"));
JButton button = new JButton("FlowLayout");
button.setBorder(BorderFactory.createRaisedBevelBorder());
pane.add(button);
pane.add(new JTextField(30));
pane.add(new JTextArea("This is the textarea of this FlowLayout", 5,10));
pane.add(new JLabel("This is the label created by flowlayout"));
pane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
}

No comments: