原因
package assset.huang;
import java.awt.BorderLayout;
import java.awt.Frame;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.Rectangle;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
public class Dialog1 extends JDialog {
JPanel panel1 = new JPanel();
JTextField jTextField1 = new JTextField();
JTextField jTextField2 = new JTextField();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
public Dialog1(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
this.setSize(400,400);
this.setVisible(true);
pack();
} catch (Exception exception) {
exception.printStackTrace();
}
}
public Dialog1() {
this(new Frame(), "Dialog1 ", false);
}
private void jbInit() throws Exception {
panel1.setLayout(null);
this.getContentPane().setLayout(null);
jTextField1.setBounds(new Rectangle(225, 58, 72, 21));
jTextField2.setBounds(new Rectangle(225, 123, 72, 21));
jLabel1.setText( "用户 ");
jLabel1.setBounds(new Rectangle(68, 58, 42, 21));
jLabel2.setText( "密码 ");
jLabel2.setBounds(new Rectangle(64, 123, 42, 21));
jButton1.setBounds(new Rectangle(38, 199, 83, 25));
jButton1.setText( "确定 ");