importjavax.swing.*;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JPasswordField;importjavax.swing.JTextField;publicclassUs...
import javax.swing.*;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class User extends JFrame {
public JPanel useJPanel;
public JButton btn1;
public JButton btn2;
public JTextField text1;
public JPasswordField pdwField;
public JLabel userlog;
public JLabel username;
public JLabel userpdw;
public void Userlog(){
useJPanel =new JPanel();
userlog = new JLabel("用户登录");
username = new JLabel("用户名:");
userpdw = new JLabel("密 码:");
text1 =new JTextField();
pdwField = new JPasswordField();
btn1 =new JButton("登录");
btn2 =new JButton("取消");
usermain();
}
public void usermain(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setSize(300,200);
this.useJPanel.setLayout(null);
this.userlog.setBounds(120,15,60,20);
this.username.setBounds(50,55,60,20);
this.userpdw.setBounds(50,85,60,25);
this.text1.setBounds(110,55,120,20);
this.pdwField.setBounds(110,85,120,20);
this.btn1.setBounds(85,120,60,20);
this.btn2.setBounds(155,120,60,20);
this.useJPanel.add(userlog);
this.useJPanel.add(username);
this.useJPanel.add(userpdw);
this.useJPanel.add(text1);
this.useJPanel.add(pdwField);
this.useJPanel.add(btn1);
this.useJPanel.add(btn2);
this.add(useJPanel);
this.setVisible(true);
}
public static void main(String []args){
new User();
}
}
知道问题所在了……看看各位能不能细心点喽!嘿嘿,回答出来就给分!不是故意卖弄的 ,这分不能不给,但是我挣分也不容易的哦
展开