双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

相关推荐

Java Swing JPasswordField密码框的实现示例

主要介绍了Java Swing JPasswordField密码框的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

weixin_38717980

java swing-JPasswordField的使用

JPasswordField是Swing库提供的一个密码输入框组件。与普通的文本输入框不同,JPasswordField会隐藏用户输入的字符,用圆点或星号等符号代替,以保护密码的安全性。

java入门选手

Java高级程序设计:第12章-基本控件.pptx

本章目标;JLabel(标签);JLabel常用方法;JButton(按钮);JTextField(文本框);JTextArea(文本区域);JPasswordField(密码框) ;JCheckBox(复选框);JRadioButton(单选按钮);组合框JComboBox;组合框JComboBox—事件;public class Test4 extends JFrame implements ActionListener { String[] items = { "篮球", "足球", "乒乓球" }; JComboBox<String> box = new JComboBox<String>(items); Test4() { box.addItem("排球"); this.setLayout(new FlowLayout()); this.add(box); box.addActionListener(this); } public static void main(String[] args) { new Test4().setVisible(true); } public

知识世界

JAVA设计qq的登陆界面

JAVA设计qq的登陆界面

bigFace2019

Java用户名密码验证实例.rar

Java用户名密码验证实例,Java窗口程序,可以学习一下在窗体中如何初始化文本输入框、初始化密码输入框、登录按钮事件处理、初始化按钮事件处理等,并设定不允许用户改变窗口大小,运行效果如截图所示。   public class JPasswordFieldDemo extends JFrame {   JTextField username; //用户名输入框   JPasswordField password; //密码输入框   JButton logonButton; //登录按钮   JButton cancelButton; //退出按钮   public JPasswordFieldDemo() { //构造函数    super("JPasswordField演示"); //调用父类构造函数    Container container=getContentPane(); //得到容器    container.setLayout(new GridLayout(3, 2, 2, 2)); //设置布局管理器    username=new JTextField(16); //初始化文本输入框,宽度为16列    password=new JPasswordField(16); //初始化密码输入框,宽度为16列    logonButton=new JButton("登录"); //初始化登录按钮    logonButton.addActionListener( //登录按钮事件处理    new ActionListener(){    public void actionPerformed(ActionEvent evt){    char[] pw=password.getPassword(); //得到密码    String message="您的用户名:" username.getText() "\n您的密码:" new String(pw); //消息字符串    JOptionPane.showMessageDialog(JPasswordFieldDemo.this, message); //显示消息    }    });    cancelButton=new JButton("退出"); //初始化退出按钮    cancelButton.addActionListener( //初始化按钮事件处理    new ActionListener(){    public void actionPerformed(ActionEvent evt){    System.exit(0); //退出程序    }    });

weixin_39841848
评论
收藏 已收藏
分享
返回顶部