如何在Java中隐藏JFrame窗口上默认的最小化/最大化和关闭按钮?
我想知道是否可以创建一个没有默认最大化/最小化(-)和关闭(x)按钮的 JFrame
窗口!我在每个框架上添加了自定义按钮,这样用户就不必弄乱窗口右上角的默认按钮!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想知道是否可以创建一个没有默认最大化/最小化(-)和关闭(x)按钮的 JFrame
窗口!我在每个框架上添加了自定义按钮,这样用户就不必弄乱窗口右上角的默认按钮!
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
您可以使用 JWindow 因为默认情况下是 un_decorated ,但您可以 setUndecorated() 对于 JFrame/JDialog
另一种方法是
实现 WindowListener
setDefaultCloseOperations
You can use JWindow because is by default un_decorated, but you can setUndecorated() for JFrame/JDialog
another ways are
implements WindowListener
setDefaultCloseOperations
使用 JFrame.setDefaultLookAndFeelDecolated。这可能不是你真正需要的东西,但医生说,
试试这个代码:
这将删除整个标题栏。另请查看此线程 。
否则使用 JWindows。
Use JFrame.setDefaultLookAndFeelDecorated. It may not be the exact thing you need but doc says,
Try this code:
This will remove the entire titlebar. Also take a look at this thread.
Otherwise use JWindows.
将使“X”按钮不起作用。这对我有用。
Will make the 'X' button no functioning. It's works for me.
如果您使用的是 Netbean,则只需在属性中取消选择可调整大小选项即可。
它只会禁用最小化/最大化按钮。
If you are using Netbean then just unselect the resizable option in properties.
It will only disable Minimize/Maximize Button.