JFrame的变量名为jf
JDialog的类名为Fff
btnLoadImage.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
Fff myff = new Fff();
//myff.setModal(false);
myff.setModalityType(ModalityType.APPLICATION_MODAL);
myff.setVisible(true);
//如果是点击确定,则文本框中输入的内容显示出来
String strText;
int iReturn;
iReturn = myff.f_GetCoseType();
if (iReturn == 0) {
lbImage.setText("选择了取消");
}
else
{
strText = myff.f_GetText();
lbImage.setText(strText);
}
}
});
Fff的类
package bb;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
impor