Java swing 密码框的使用

时间:2014-05-03 16:18:32   收藏:0   阅读:355
/**
 * Java swing 密码框的使用
 * @author gao
 */
package com.gao;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.border.EmptyBorder;

public class JPasswordFieldDemo extends JFrame {
	public JPasswordFieldDemo(){
		this.setTitle("密码框的使用");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 250, 100);
		JPanel contentPane=new JPanel();
		contentPane.setBorder(new EmptyBorder(5,5,5,5));
		contentPane.setLayout(new BorderLayout(0,0));
		this.setContentPane(contentPane);
		JLabel label=new JLabel("密码:");
		contentPane.add(label,BorderLayout.WEST);
		JPasswordField passWordField=new JPasswordField();
		contentPane.add(passWordField,BorderLayout.CENTER);
		this.setVisible(true);
	}
   public static void main(String []args){
	   JPasswordFieldDemo example=new JPasswordFieldDemo();
   }
}
bubuko.com,布布扣

Java swing 密码框的使用,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!