【发布时间】:2013-07-30 13:42:14
【问题描述】:
我在 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.)
谁能帮我解决这个问题?提前致谢。
【问题讨论】:
-
int id = JOptionPane.showInputDialog(rootPane, "输入要验证的注册 ID。", "验证", JOptionPane.QUESTION_MESSAGE);
-
你传递的不是
rootPane中的 Frame 吗? -
@kiheru rootpane 是 JRootPane javax.swing.JFrame.rootPane。它是管理此框架的 contentPane 和可选 menuBar 以及 glassPane 的实例。
-
@mKorbel int id 显示错误。它只接受字符串。
-
尝试传递框架本身,而不是 rootPane。
标签: java swing ubuntu system-error