package jiemian;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;public class login extends JFrame { JPanel jp = null; JLabel usernameLabel = null; JTextField usernametf = null; JLabel passLabel = null; JPasswordField passtf = null; JButton loginB = null; JButton canelB = null; //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); public void loginj(){ setTitle("登录"); jp=new JPanel(); jp.setBounds(100, 100, 100, 100); usernameLabel=new JLabel("用户名"); usernameLabel.setBounds(120,120,20,10); usernametf = new JTextField(15); usernametf.setBounds(150, 120, 40, 10); passLabel = new JLabel("密 码:"); passLabel.setBounds(120, 140, 20, 10); passtf = new JPasswordField(15); passtf.setBounds(150, 140, 40, 10); loginB = new JButton("登录"); canelB = new JButton("退出"); jp.add(passLabel); jp.add(usernameLabel); jp.add(usernametf); jp.add(passtf); jp.add(loginB); jp.add(canelB); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.add(jp); setVisible(true); jp.setVisible(true); } public static void main(String[] args) { //login login1=new login(); }}
添加回答
举报
0/150
提交
取消