码迷,mamicode.com
首页 > 其他好文 > 详细

简单的用户登陆界面

时间:2015-06-16 22:40:42      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

//check.java
package check;
import javax.swing.*;
public class check extends JPanel{
	JLabel namelabel1,namelabel2;
	JTextField name;
	JPasswordField password;
	JButton okButton,cancelButton;
	
	public check(){
		namelabel1 = new JLabel("用户名:");
		namelabel2 = new JLabel("密码:");
		name = new JTextField(20);
		password = new JPasswordField(20);
		okButton = new JButton("ok");
		cancelButton = new JButton("cancel");
		add(namelabel1);
		add(name);
		add(namelabel2);
		add(password);
		add(okButton);
		add(cancelButton);
	}
}

//Jframe.java
package check;
import javax.swing.*;
import java.awt.*;
public class Jframe extends JFrame{
	check panel;
	private static final int D_width=320;
	private static final int D_height=120;
	public Jframe(){
		setSize(D_width,D_height);
		setTitle("登陆");
		panel = new check();
		getContentPane().add(panel);
		setVisible(true);
		setResizable(false);
	}
}

//main.java
package check;

import javax.swing.*;

public class main extends JFrame{
	public static void main(String[] args){
		Jframe frame= new Jframe();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}

  

简单的用户登陆界面

标签:

原文地址:http://www.cnblogs.com/hugh0510/p/4581770.html

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