package 登录界面;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class demo1 {
public static void main(String[] args){
JFrame frame = new JFrame("登录界面");
frame.setLayout(null);
JLabel name = new JLabel("用户名:");
JLabel password = new JLabel("密码:");
JButton jButton = new JButton("登录");
JTextField textField = new JTextField(15);
JPasswordField passwordField = new JPasswordField(15);
frame.setSize(400,250);
name.setBounds(60, 60, 54, 20);
password.setBounds(60, 90, 54, 20);
jButton.setBounds(148, 120, 62, 28);
textField.setBounds(130, 60, 166, 21);
passwordField.setBounds(130, 90, 166, 21);
frame.add(name);
frame.add(password);
frame.add(jButton);
frame.add(textField);
frame.add(passwordField);
frame.setVisible(true);
}
}
实验结果
原文:https://www.cnblogs.com/LuZhenYu/p/11872723.html