【问题标题】:The program 'java.ori' received an X Window System error程序“java.ori”收到 X Window 系统错误
【发布时间】: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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2022-11-17
    • 2020-05-16
    • 1970-01-01
    • 2017-04-03
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    • 2011-03-03
    • 2020-10-24
    相关资源
    最近更新 更多