JDialog在Linux上未显示最小化/关闭按钮
这个问题以前曾被问过,但根据我的发现,这些问题和答案来自几年前,希望有更新/新的信息.
This question has been asked previously but from what I have found, the questions and responses are from a few years ago and hoping there is updated/new information.
相同的代码在Windows上也可以正常运行,因为它在右上角显示了X. 在Linux上,右上角没有显示任何内容. Windows正在使用JDK 1.8.0_60 Linux正在使用1.8.0_111-b15
The same code works on Windows as it displays the X in the top right corner. On Linux, nothing appears in the top right corner. Windows is using JDK 1.8.0_60 Linux is using 1.8.0_111-b15
基于研究,已知此问题存在于各种口味的Linux中.
Based on the research, this issue is known to exist on varying flavors of Linux.
import javax.swing.JDialog;
public class JDialogSimple{
private JDialog dialog = new JDialog();
public JDialogSimple() {
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setModal(true);
dialog.pack();
dialog.setLocation(200, 200);
dialog.setSize(400, 400);
dialog.setTitle("Test Dialog");
dialog.setVisible(true);
}
public static void main(String args[]) {
JDialogSimple colourDialog = new JDialogSimple();
}
}
是否有与此相关的新信息? 现在是Linux平台上可接受的行为吗?
Has any new information come about related to this? Is this now the accepted behavior on the Linux platform?
我注意到发布答案的一个线程具有以下内容:
I noticed the one thread that posts an answer has the following :
super(null, title, Dialog.ModalityType.MODELESS);
我认为应该是以下情况:
I think it should have been the following :
super(null, title, Dialog.ModalityType.APPLICATION_MODAL);
对于我的测试,将以上内容从MODELESS更改为APPLICATION_MODAL,Linux JDialog现在显示X来关闭窗口.
For my test, changing the above from MODELESS to APPLICATION_MODAL, the Linux JDialog now showed the X to close the window.