我在Ubuntu 11.10上有一个桌面应用程序,并且我实现了一个功能,当任何用户点击一个特定按钮时,都会打开一个输入对话框并要求用户输入。
public void actionPerformed(ActionEvent e) {
//Shows a input dialog asking the template ID to verify
String id = JOptionPane.showInputDialog(rootPane,
"Enter the Enrolled ID to verify.", "Verify",
JOptionPane.QUESTION_MESSAGE);
}
因此,用户填写该值并单击"确定"按钮,甚至试图关闭对话框应用程序,都会出现错误并崩溃。
错误:
The program 'java.ori' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 2262 error_code 3 request_code 20 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
有人能帮我解决这个问题吗?提前谢谢。
我认为rootPane不适合作为JOptionPane将显示的JDialog的父级。它应该是一个JFrame或其他JDialog。