如何设置JInternalFrame的大小

发布于 2024-12-26 23:51:00 字数 746 浏览 6 评论 0原文

我有一个 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?

This is a windows view

This is a MacOsX view

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑叹一世浮沉 2025-01-02 23:51:00
setPreferredSize(new Dimension(700, 500));
setMaximumSize(new Dimension(700, 500));
setMinimumSize(new Dimension(700, 500));
setMaximizable(true);

为我工作!

setPreferredSize(new Dimension(700, 500));
setMaximumSize(new Dimension(700, 500));
setMinimumSize(new Dimension(700, 500));
setMaximizable(true);

work for me!

¢好甜 2025-01-02 23:51:00

我会参考 InternalFrameDemo。您的程序的设置方式可能与此示例不同,但它肯定会有所帮助。我能够让程序正常工作,并且我有一个 Windows 操作系统。

另外,如果您想参考此示例,请务必在 frame.setVisible(true); 之前的 createMethod() 中包含这些代码行。

// Set your preferred size and location here
frame.setSize(x,y);
frame.setLocation(x,y);

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() before frame.setVisible(true); if you want to refer to this example.

// Set your preferred size and location here
frame.setSize(x,y);
frame.setLocation(x,y);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文