编写一个Java JApplet小应用程序,添加2个文本框,一个用于显示标题"请输入密码:",另一个用于输入密码*号 20
2个回答
展开全部
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class test1 extends JApplet {
private final JLabel label = new JLabel();
private final JLabel label_1 = new JLabel();
private final JTextField textField = new JTextField();
private final JPasswordField passwordField = new JPasswordField();
/**
* Create the applet
*/
public test1() {
super();
try {
jbInit();
} catch (Throwable e) {
e.printStackTrace();
}
//
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
getContentPane().add(label);
label.setText("用户名:");
label.setBounds(46, 53, 66, 18);
getContentPane().add(label_1);
label_1.setText("密码:");
label_1.setBounds(46, 113, 66, 18);
getContentPane().add(textField);
textField.setBounds(118, 53, 87, 22);
getContentPane().add(passwordField);
passwordField.setBounds(118, 113, 94, 22);
}
}
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class test1 extends JApplet {
private final JLabel label = new JLabel();
private final JLabel label_1 = new JLabel();
private final JTextField textField = new JTextField();
private final JPasswordField passwordField = new JPasswordField();
/**
* Create the applet
*/
public test1() {
super();
try {
jbInit();
} catch (Throwable e) {
e.printStackTrace();
}
//
}
private void jbInit() throws Exception {
getContentPane().setLayout(null);
getContentPane().add(label);
label.setText("用户名:");
label.setBounds(46, 53, 66, 18);
getContentPane().add(label_1);
label_1.setText("密码:");
label_1.setBounds(46, 113, 66, 18);
getContentPane().add(textField);
textField.setBounds(118, 53, 87, 22);
getContentPane().add(passwordField);
passwordField.setBounds(118, 113, 94, 22);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询