JAVA JFrame 学习之 3种布局
由于单位需要,又把之前学的JAVA重新拾起来了,先从最基本的布局学起来吧。
直接上代码
package com.liutong.swing.grid;
import javax.swing.;
import java.awt.;
public class gridlayout extends JFrame {//必须把这个 JFrame 继承才能继续下去
/**
* @param args
*/
JPanel jp1,jp2,jp3;
JButton jb1,jb2,jb3;
JLabel jl1,jl2;
public static void main(String[] args) {
// TODO Auto-generated method stub
new gridlayout();
}
//网格布局
public gridlayout(){
this.setTitle("整体是网格布局,第一个流布局,第二个是网格布局,第三个是边界布局");
this.setLayout(new GridLayout(3,1,10,10));
jp1=new JPanel();
jp2=new JPanel();
jp3=new JPanel();
jl1=new JLabel("网格布局 GridLayout");
String borderName [] = {"North","South","West","East","Center"};
String border [] = {BorderLayout.NORTH,BorderLayout.SOUTH,BorderLayout.WEST,
BorderLayout.EAST,Border