使桌面应用程序窗口的大小保持不变 [英] Making the size of desktop app window stay the same

查看:122
本文介绍了使桌面应用程序窗口的大小保持不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NetBeans JBuilder开发桌面Java应用程序。我使程序的内容(首页)适合相对较小的窗口。我正在使用GridBagLayout。一旦运行该程序并使用窗口右上角的按钮将其放大,该程序便会占用笔记本电脑的所有屏幕。但是内容看起来像一团糟。我想在按下后即拒绝放大,即无论您是否放大,我都希望程序保持相同的大小。
怎么做?

I am developing desktop Java application using NetBeans JBuilder. I make the contents of the program (front page) to fit in a relatively small window. I am using GridBagLayout. Once I run the program and zoom it in with the button on the right top hand side of the window the program takes all the screen of my laptop. But the contents looks like a mess. I want to deny zoom in once it is pressed i.e. I want my program to stay in the same size no matter whether you zoom it in or not. How to do that?

推荐答案


该程序默认情况下不会扩展JFrame或JDialog。它使用了Swing Application Framework库,该库已成为项目的一部分。它扩展了FrameView类。

The program by default does not extend JFrame or JDialog. It is using Swing Application Framework library which is made part of project. It extends FrameView class.

您应该真正尝试RTM。我没有使用这个废弃的API,但是只花了几秒钟的时间就发现了... FrameView.getFrame()

You should really try RTM. I don't use this abandoned API, yet it took just a few seconds to discover... FrameView.getFrame().

然后,您当然可以使用Jeffrey的 Frame.setResizable(boolean)

Then of course, you can use Jeffrey's advice of Frame.setResizable(boolean).

这篇关于使桌面应用程序窗口的大小保持不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆