JFrame.setDefaultLookAndFeelDecorated(true); [英] JFrame.setDefaultLookAndFeelDecorated(true);

查看:36
本文介绍了JFrame.setDefaultLookAndFeelDecorated(true);的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Java 中使用 setDefaultLookAndFeelDecorated(true) 方法时为什么当我最大化框架时框架会出现全屏?以及如何在此方法中禁用全屏模式?

when i use setDefaultLookAndFeelDecorated(true) method in Java why is the Frame appear FullScreen when i maximize the Frame ? and how can i disaple the FullScreen mode in this method ?

推荐答案

setDefaultLookAndFeelDecorated 设置为 true 会导致装饰由观感处理;这意味着 Windows 和 Mac 上的系统外观(我现在手头没有 Linux)保留了您期望它们的本机窗口的边框,例如远离 Windows 中的任务栏.

Setting setDefaultLookAndFeelDecorated to true causes the decorations to be handled by the look and feel; this means that a System look-and-feel on both Windows and Mac (I have no Linux at hand now) retains the borders you would expect them of a native window, e.g. staying clear of the taskbar in Windows.

当使用跨平台外观,又名 Metal,这是 Windows 的默认设置时,Windows 版本将接管整个屏幕,使其看起来像一个全屏窗口.在 Mac 上,OS 拒绝泄露自己的标题栏,并在 Mac 原生窗口中绘制了一个完整的 Metal 框架(包括标题栏).

When using the Cross Platform look-and-feel, a.k.a. Metal, which is the default on Windows, the Windows version will take over the entire screen, making it look like a full-screen window. On Mac, the OS refuses to give away its own titlebar, and draws a complete Metal frame (including the title bar) in a Mac-native window.

因此,简而言之,如果您想确保任务栏得到尊重,请在 Windows 上使用 Windows 系统外观.您可以使用诸如

So, in short, if you want to make sure the taskbar gets respected, use the Windows system look-and-feel on Windows. You can set it by using something like

UIManager.setLookAndFeel((LookAndFeel) Class.forName(UIManager.getCrossPlatformLookAndFeelClassName()).newInstance());

这篇关于JFrame.setDefaultLookAndFeelDecorated(true);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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