SWING 界面设计

package ziwojieshao;
import java.awt.FlowLayout;
import javax.swing.*;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.*;

public class hello extends JFrame{
public hello()
{
JFrame test=new JFrame ("自我介绍");
test.setLayout(new GridLayout(0,2));
test.getContentPane().add(new JLabel("姓名")) ;
test.getContentPane().add(new JTextField("朱玉玲",8)) ;
test.getContentPane().add(new JLabel("性别")) ;

test.setSize(180,210);
test.getContentPane().add(new JTextField("女",2));
String proList[] = { "年龄","民族" ,"籍贯","学号","学院","专业"};
test.getContentPane().add(new JLabel(proList[0]));
test.getContentPane().add(new JTextField("20",2));
test.getContentPane().add(new JLabel(proList[1]));
test.getContentPane().add(new JTextField("汉族",4));
test.getContentPane().add(new JLabel(proList[2]));
test.getContentPane().add(new JTextField("武汉",4));
test.getContentPane().add(new JLabel(proList[3]));
test.getContentPane().add(new JTextField("20173311120",8));
test.getContentPane().add(new JLabel(proList[4]));
test.getContentPane().add(new JTextField("计算机学院",8));
test.getContentPane().add(new JLabel(proList[5]));
test.getContentPane().add(new JTextField("网络工程",8));

test.setVisible(true);
}    
public static void main (String[] args) {
new hello();
}

}

心得体会

编程能力还是不行,在同学的帮助下完成

猜你喜欢

转载自www.cnblogs.com/zyl9/p/11042304.html