开发者

is it possible to change titlebar color of JFrame or JInternalFrame

开发者 https://www.devze.com 2022-12-24 02:33 出处:网络
I am trying to change title bar color.but it dosen\'t work UIManager.put(\"JFrame.activeCaption\", new javax.swing.plaf.ColorUIResource( Color.GREEN));

I am trying to change title bar color.but it dosen't work

UIManager.put("JFrame.activeCaption", new javax.swing.plaf.ColorUIResource( Color.GREEN)); JFrame.setDefaultLookAndFee开发者_运维知识库lDecorated(true);


I do not think that you can do anything about the colors in the title bar of a JFrame, at least not without using native code to implement a platform-specific solution. That is because JFrame actually uses your native windowing system to create the window.

As for internal frames, it would make sense for you to be able to customize it, since it is a component rendered inside of a window that is controlled by Java. Indeed, there are plenty of JInternalFrame properties that you can set in your UI manager. However, I wasn't able to get those to work on my system.

Doing a little googling, it appears that others have found that you cannot change the appearance of JInternalFrame without changing your whole system's look and feel settings. So, I'm afraid that you might have to depend on the operating system to control the colors of your title bars even when using internal frames.


OK I think Joe said it best, but remember you can decide not to decorate the Frame and then within the frame provide the ability to decorate it yourself. I have a Skin like set of custom AWT containers that do just that. The result is a GUI that looks or behaves nothing like what a Typical frame does--not "Rectangular" or "Square" "real estate" but something more like the Skins of applications like Winamp that cause the shape of the GUI to be asymmetric in design and look by by using the Alpha level in the OS GUI layer. In my Skin-able containers the "Skin" is an Image that is "cookie cut" up of a single image and then based on the geometry of Skin class draw and maintain those described areas--I only mention this as a way to literally "think outside of the box" of the type of problem.

WM

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号