实验十二—swing编程

Posted zrwhaha

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实验十二—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();

技术图片

 

以上是关于实验十二—swing编程的主要内容,如果未能解决你的问题,请参考以下文章

实验十二:SWING界面设计

第十二周编程总结

第十二周编程总结

实验十二

201771010111 李瑞红 《第十二周学习总结》

第十二周课程总结