码迷,mamicode.com
首页 > 编程语言 > 详细

Day 4 : QQReg.java

时间:2016-10-26 00:46:03      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:end   swing   com   flow   ati   extends   http   tle   username   

技术分享

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

public class QQReg extends JFrame{
public static void main(String[] args){
QQReg w = new QQReg();
w.setVisible(true);
}
QQReg(){
//设置窗体的基本信息
this.setSize(660 , 380);
this.setLocationRelativeTo(null);
this.setTitle("Talking.GHOUL.Reg");
this.setResizable(false);
this.setIconImage(this.getToolkit().getImage("D:/lab_2/psb (11).jpg"));
//new组件&设置组件
JLabel labTitle = new JLabel(" SIGN UP ");
labTitle.setFont(new Font("", 0, 36));

JLabel labUser = new JLabel(" Username");
labUser.setFont(new Font("", 0, 30));
JLabel labPass = new JLabel(" Password");
labPass.setFont(new Font("", 0, 30));
JLabel labPassRe = new JLabel(" Confirm Password");
labPassRe.setFont(new Font("", 0, 30));

JComboBox cmbUsername = new JComboBox();
cmbUsername.setFont(new Font("", 0, 30));
cmbUsername.addItem("かねき けん");
cmbUsername.addItem("Kaneki Ken");
cmbUsername.addItem("金木 研");

JPasswordField txtPass = new JPasswordField();
txtPass.setFont(new Font("", 0, 25));
JPasswordField txtPassRe = new JPasswordField();
txtPassRe.setFont(new Font("", 0, 25));

JButton btnReg = new JButton(" CONFIRM ");
btnReg.setFont(new Font("", 0, 30));
//布置主面板
JPanel panUser = new JPanel();
panUser.setLayout(new GridLayout(3 , 3));

panUser.add(labUser);
panUser.add(cmbUsername);
panUser.add(labPass);
panUser.add(txtPass);
panUser.add(labPassRe);
panUser.add(txtPassRe);
//布置按钮面板
JPanel panButton = new JPanel();
panButton.setLayout(new FlowLayout());

panButton.add(btnReg);
//布置窗体
this.setLayout(new BorderLayout());

this.add(labTitle , BorderLayout.NORTH);
this.add(panUser , BorderLayout.CENTER);
this.add(panButton , BorderLayout.SOUTH);
}
}

 

Day 4 : QQReg.java

标签:end   swing   com   flow   ati   extends   http   tle   username   

原文地址:http://www.cnblogs.com/xkxf/p/5998737.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!