标签:
//check.java package check; import javax.swing.*; public class check extends JPanel{ JLabel namelabel1,namelabel2; JTextField name; JPasswordField password; JButton okButton,cancelButton; public check(){ namelabel1 = new JLabel("用户名:"); namelabel2 = new JLabel("密码:"); name = new JTextField(20); password = new JPasswordField(20); okButton = new JButton("ok"); cancelButton = new JButton("cancel"); add(namelabel1); add(name); add(namelabel2); add(password); add(okButton); add(cancelButton); } } //Jframe.java package check; import javax.swing.*; import java.awt.*; public class Jframe extends JFrame{ check panel; private static final int D_width=320; private static final int D_height=120; public Jframe(){ setSize(D_width,D_height); setTitle("登陆"); panel = new check(); getContentPane().add(panel); setVisible(true); setResizable(false); } } //main.java package check; import javax.swing.*; public class main extends JFrame{ public static void main(String[] args){ Jframe frame= new Jframe(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
标签:
原文地址:http://www.cnblogs.com/hugh0510/p/4581770.html