package exp11; import javax.swing.*; public class Tools { private String userInfoPath = "userinfo.txt"; public static JFrame creatDefaultJFrame(String title){ JFrame f = new JFrame(title); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setSize(400, 300); f.setLayout(null); f.setLocationRelativeTo(f); f.setAlwaysOnTop(true); f.setResizable(false); JLabel accountJLabel = new JLabel("账号"); accountJLabel.setBounds(50, 50, 50, 20); JTextField accounJTextField = new JTextField(); accounJTextField.setBounds(100, 50, 200, 20); JLabel passwordJLabel = new JLabel("密码"); passwordJLabel.setBounds(50, 100, 50, 20); JPasswordField passwordField = new JPasswordField(); passwordField.setBounds(100, 100, 200, 20); f.add(accountJLabel); f.add(accounJTextField); f.add(passwordJLabel); f.add(passwordField); return f; } }