1、第一步,打开MyEclipse开发工具,在指定的包里创建Java类JPasswordFrame,如下图所示:

3、第三步,设置文本域的样式属性,usernameText.setFont(font); u衡痕贤伎sernameText.setColumns(泌驾台佐30); usernameText.setVisible(true); usernameText.setForeground(Color.BLACK); usernameText.setBackground(Color.LIGHT_GRAY);如下图所示:

5、第五步,在JPanel加上文本域和密码域panel.setVisible(true); panel.add(usernameTe旌忭檀挢xt); panel.add(password); frame.setBackground(Color.WHITE); frame.setBounds(100, 100, 600, 400); frame.setFont(font); frame.setForeground(Color.GRAY); frame.setVisible(true); frame.add(panel);如下图所示:

7、第七步,修改文本域、密码域部分设置属性,运行Java类,查看设置效果,如下图所示:
