我想这样做如下:只显示滚动条在必要时
public class MyCustomDialog extends JDialog
{
public MyCustomDialog()
{
if (getClientVertScreenSize() < 800)
{
// Set the vertical size as 600, and give them a scroll pane to navigate to the bottom of the gui.
}
else
{
setSize(600, 800); // No need to add a scroll pane.
}
}
}
麻烦的是我不知道如何检查客户的屏幕尺寸,所以不知道如何编写我的构造函数依赖的方法。
不错,这是我在想什么,但是这把滚动条中的JDialog如果内容不适合在JDialog中,对吗?这是我的测试显示。但是,我试图做一些稍微不同的事情。如果整个JDialog不适合客户端屏幕,那么我希望整个GUI缩小。让我知道,如果澄清的话。 – Sal 2012-04-26 02:33:25