Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

java - FileDialog generating GtkDialog mapped without a transient parent. This is discouraged

My java code is generating the following message when I create a open FileDialog and make it visible. I have checked the code against code examples and I can't find anything wrong. And I am passing in the parent frame reference into the constructor. This is the code example:

public void open() {
    if (openAreYouSure()) {
    MyFilenameFilter filter = new MyFilenameFilter(Editor.JAWS_FILE_TYPE);

    FileDialog d = new FileDialog(frame, "Open", FileDialog.LOAD);
    d.setFilenameFilter(filter);
    d.setBackground(lightSteelBlue3);

    if (!mostRecentDir.equals(""))
        d.setDirectory(mostRecentDir);

    d.setVisible(true);

    String path = d.getDirectory();
    String file = d.getFile();

    if (path != null && file != null) {
        Editor.logger.info("opened file: " + path + file);
        newSession();

        mostRecentDir = path;
        openFile(path + file);
    }
    }
}

This comes out when the d.setVisible(true); is called.

Gtk-Message: 12:10:44.979: GtkDialog mapped without a transient parent. This is discouraged.

This is the version of java I am using on centos 7.

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.275.b01-0.el7_9.x86_64/jre/bin/java

All the write ups on this type of messages say its caused because you didn't pass in the parent into the dialog you are created, but I am in the constructor. This is happening for all pop dialog my application is creating.

Does anyone have any idea how to suppress or fix this problem? I am not seeing any java bug report on this, but I assume there is somewhere.

question from:https://stackoverflow.com/questions/65893088/filedialog-generating-gtkdialog-mapped-without-a-transient-parent-this-is-disco

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...