写了一个简单的frame 打开一个 jdialog的类
打开后,jdialog要点关闭3次才能关闭,
这是frame中的打开事件
jbutton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
ChoiceExcelInfo choice = new ChoiceExcelInfo(null,"1");
choice.setVisible(true);
choice.show();
}
});
checkBox.setVisible(true);以下是jdialog public ChoiceExcelInfo(JFrame parent, String type) {
super(parent);
this.setSize(600, 700);
if (type.equals("1")) {
checkPanel.setBounds(10,10,500,550);
checkPanel.setLayout(new GridLayout(10, 3, 80, 20));
checkPanel.add(extUsrNo);
} jbutton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,"确定");
}
});
this.getContentPane().add(checkPanel);
buttonPanel.add(jbutton);
this.getContentPane().add(buttonPanel);
this.setModal(true);
打开后,jdialog要点关闭3次才能关闭,
这是frame中的打开事件
jbutton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
ChoiceExcelInfo choice = new ChoiceExcelInfo(null,"1");
choice.setVisible(true);
choice.show();
}
});
checkBox.setVisible(true);以下是jdialog public ChoiceExcelInfo(JFrame parent, String type) {
super(parent);
this.setSize(600, 700);
if (type.equals("1")) {
checkPanel.setBounds(10,10,500,550);
checkPanel.setLayout(new GridLayout(10, 3, 80, 20));
checkPanel.add(extUsrNo);
} jbutton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,"确定");
}
});
this.getContentPane().add(checkPanel);
buttonPanel.add(jbutton);
this.getContentPane().add(buttonPanel);
this.setModal(true);
choice.setVisible(true);
choice.show(); 你這就是3次了 只要一個 就可以了 三句都是重復的意思 實現的是一個功能 都是讓窗口顯示出來