2

我在 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.)

谁能帮我解决这个问题?提前致谢。

4

1 回答 1

0

我相信,rootPane 不适合作为将由 JOptionPane 显示的 JDialog 的父级。它应该是 JFrame 或其他 JDialog。

于 2014-01-14T08:41:23.253 回答