JDialog 未打开至其设置的大小?
为什么当我启动 JDialog
时,它会以缩小的方式弹出!我必须调整它的大小才能看到它的内容,而一些内容(例如标签)根本不显示!有什么我应该做的设置吗?
我不知道你是否看到我在安德鲁的解决方案下的评论。我只是想说 pack() 方法解决了 jDialog 以缩小的方式显示的问题,但是,我仍然遇到这个问题,即该 jDialog 中的一些控制器根本不显示或以随机调整大小的方式显示方式。如果您也能针对这种情况提供补救措施,我将非常感激!
jDialog_DSCredentials = new javax.swing.JDialog();
jDialog_DSCredentials.setTitle(resourceMap.getString("jDialog_DSCredentials.title")); // NOI18N
jDialog_DSCredentials.setLocationByPlatform(true);
jDialog_DSCredentials.setName("jDialog_DSCredentials"); // NOI18N
jDialog_DSCredentials.getContentPane().setLayout(new java.awt.CardLayout());
// Code of sub-components and layout - not shown here (I can send these if nec.)
这是从事件方法调用它的方式
jDialog_DSCredentials.pack();
jDialog_DSCredentials.revalidate();
jDialog_DSCredentials.setVisible(true);
Why when I launch my JDialog
it pops up in a shrunken manner! I would have to resize it to see its contents and some of the contents like the labels don't show at all! Is there any settings that I should do?
I don't know whether you guy saw my comment under Andrew's solution. I just wanted to say that the pack() method solved the issue of jDialog showing in a shrunken way, however, I still have this problem that some of my controllers within this jDialog either don't show at all or shown in a randomly resized way. If you could also provide a remedy for this situation I would be very much thankful!
jDialog_DSCredentials = new javax.swing.JDialog();
jDialog_DSCredentials.setTitle(resourceMap.getString("jDialog_DSCredentials.title")); // NOI18N
jDialog_DSCredentials.setLocationByPlatform(true);
jDialog_DSCredentials.setName("jDialog_DSCredentials"); // NOI18N
jDialog_DSCredentials.getContentPane().setLayout(new java.awt.CardLayout());
// Code of sub-components and layout - not shown here (I can send these if nec.)
and here is how it's called from an event method
jDialog_DSCredentials.pack();
jDialog_DSCredentials.revalidate();
jDialog_DSCredentials.setVisible(true);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要使顶级组件成为显示内容所需的最小尺寸,请调用:
To have a top-level component become the smallest size it needs to show the content, call: