is it possible to change titlebar color of JFrame or JInternalFrame

后端 未结 2 1366
谎友^
谎友^ 2021-01-16 23:02

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.

相关标签:
2条回答
  • 2021-01-16 23:09

    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.

    0 讨论(0)
  • 2021-01-16 23:27

    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 讨论(0)
提交回复
热议问题