????????????д????????й?JAVA????????е???????????????????????????? NetBeans ??????Eclipse ???????????????????????????????????????????????????棬?????£???????????????

????JAVA??Layout Mananager??ν???????????????BorderLayout??FlowLayout??GridLayout??GridLayBagout

????1??BorderLayout??JFrame?е??????????????????????????????????岼????????????????????????????????????????????????????????????λ???????????????????????????????????BorderLayout ???СС???????
import javax.swing.*;
import java.awt.*;
public class BorderLayout1 {      
  public BorderLayout1(){
       JFrame frame=new JFrame();
        frame.add(BorderLayout.NORTH??new JButton("North"));
        frame.add(BorderLayout.SOUTH??new JButton("South"));
        frame.add(BorderLayout.WEST??new JButton("West"));
        frame.add(BorderLayout.EAST??new JButton("East"));
        frame.add(BorderLayout.CENTER??new JButton("Center"));
        frame.setVisible(true);
        frame.setSize(400??200);
    }
  public static void main(String[] args) {
         new BorderLayout1();
  }
}

????????????????浱????к?淶????????????????????????????????????д???????????????????沼??Ч????

????2??FlowLayout ?????????????????????????????????????????????棬?????????????赲?????????????????????????????????齫?????????????????????????????????????????????????С??ò???????????????£?

import javax.swing.*;
import java.awt.*;

public class FlowLayout1{
  public FlowLayout1() {
       JFrame frame=new JFrame();
       frame.setLayout(new FlowLayout());
       for(int i = 1; i <=5; i++)
       frame.add(new JButton("Button " + i));
       frame.setVisible(true);
       frame.setSize(500??100);
  }
  public static void main(String[] args) {
       new FlowLayout1();
  }
}

????3??GridLayout ????????????齫????????????????У??????????????????????????????????????????????????????????BorderLayout ???????????????????????????????????????????????????????????????????????????????????Ч???????????С?????

import javax.swing.*;
import java.awt.*;

public class GridLayout1 {
  public GridLayout1() {
     JFrame frame=new JFrame();
    frame.setLayout(new GridLayout(3??2));   //3??2?е?????
      for(int i = 0; i < 7; i++)
      frame.add(new JButton("Button " + i)); 
      frame.setVisible(true);
      frame.setSize(500??300);
  }
  public static void main(String[] args) {
       new GridLayout1();
  }
}