如何从外观上将 JFrames 设置为未修饰?
How can I set JFrames to be undecorated from a look and feel?
我正在做外观和感觉,进展顺利。当我制作外观时,我认为如果标题栏像其他外观一样是深色主题,它看起来会好得多。我想保持代码跨平台。无论如何,我可以根据我的外观制作一个未修饰的 jframe 吗?然后,我会用自定义按钮替换标题栏,以根据当前 OS.
关闭、最小化和最大化 window
在此先感谢您的帮助!
How can I set JFrames to be undecorated from a look and feel?
这不是 PLAF 的工作,所以他们不提供这种能力。
OTOH a PLAF 可以 改变 title-bar 的外观,如下所示:
只有调用以下方法才会出现PLAF风格的标题栏:JFrame.setDefaultLookAndFeelDecorated(boolean)
.
Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. If defaultLookAndFeelDecorated
is true, the current LookAndFeel
supports providing window decorations, and the current window manager supports undecorated windows, then newly created JFrame
s will have their Window
decorations provided by the current LookAndFeel
. ..
我正在做外观和感觉,进展顺利。当我制作外观时,我认为如果标题栏像其他外观一样是深色主题,它看起来会好得多。我想保持代码跨平台。无论如何,我可以根据我的外观制作一个未修饰的 jframe 吗?然后,我会用自定义按钮替换标题栏,以根据当前 OS.
关闭、最小化和最大化 window在此先感谢您的帮助!
How can I set JFrames to be undecorated from a look and feel?
这不是 PLAF 的工作,所以他们不提供这种能力。
OTOH a PLAF 可以 改变 title-bar 的外观,如下所示:
只有调用以下方法才会出现PLAF风格的标题栏:JFrame.setDefaultLookAndFeelDecorated(boolean)
.
Provides a hint as to whether or not newly created JFrames should have their Window decorations (such as borders, widgets to close the window, title...) provided by the current look and feel. If
defaultLookAndFeelDecorated
is true, the currentLookAndFeel
supports providing window decorations, and the current window manager supports undecorated windows, then newly createdJFrame
s will have theirWindow
decorations provided by the currentLookAndFeel
. ..