如何设置JInternalFrame的大小
我有一个 JFrame,其中我使用 JDesktopPane 设置内容窗格。
jDesktopPane1 = new JDesktopPane();
setContentPane(jDesktopPane1);
我的 JFrame 是全屏大小,当我
Main.getInstance().setSize(Toolkit.getDefaultToolkit().getScreenSize());
c = new Clients();
c.setVisible(true);
setEnabled(true);
Main.getInstance().addInDesktop(c);
在客户端中添加大小为 300x300 的 JInternalFrame 时:
this.setPreferredSize(new java.awt.Dimension(300, 300));
在我的 mac osx 上一切正常,如果我在 Windows 机器上使用它,即使我设置大小或首选大小,jinternalframe 也会采用全屏大小。我能做些什么?这两个操作系统之间有可能发生所有这些变化吗?
i have a JFrame in which i set the content pane with a JDesktopPane.
jDesktopPane1 = new JDesktopPane();
setContentPane(jDesktopPane1);
My JFrame is full screen size, when i add a JInternalFrame with size 300x300
Main.getInstance().setSize(Toolkit.getDefaultToolkit().getScreenSize());
c = new Clients();
c.setVisible(true);
setEnabled(true);
Main.getInstance().addInDesktop(c);
In Clients:
this.setPreferredSize(new java.awt.Dimension(300, 300));
On my mac osx all works fine, if i use it on a windows machine the jinternalframe takes fullscreensize even if i set size or preferredsize. What can i do? It's possible all this changes between the two os?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为我工作!
work for me!
我会参考 InternalFrameDemo。您的程序的设置方式可能与此示例不同,但它肯定会有所帮助。我能够让程序正常工作,并且我有一个 Windows 操作系统。
另外,如果您想参考此示例,请务必在
frame.setVisible(true);
之前的createMethod()
中包含这些代码行。I would refer to the InternalFrameDemo in Oracle's Documentation. Your program may not be set up in the same manner as this example, but it should definitely help. I was able to get the program to work properly and I have a Windows OS.
Also, be sure to include these lines of code in
createMethod()
beforeframe.setVisible(true);
if you want to refer to this example.