0

I'm learning Swing for the first time and I'm trying to change the colors of individual components using

UIManager.put("key", value),

but I'm having trouble trying to figure out how to change the color of specific components because I don't know exactly what they are called, namely the bar where the title and the close button is located. Any help would be appreciated!

  • There is a fairly complete list of keys in [this StackOverflow question](https://stackoverflow.com/questions/1951558/list-of-java-swing-ui-properties). – Steven Jul 22 '17 at 09:59
  • @StevenWolfe Yeah I read this post, my problem is that I can't figure out which one corresponds to the title bar. Seemingly none do. – user1790197 Jul 22 '17 at 10:01
  • If you're using a JFrame then it appears it can be modified using the code in the second answer [of this question](https://stackoverflow.com/questions/2482971/how-can-i-change-the-color-of-titlebar-in-jframe). – Steven Jul 22 '17 at 10:09
  • If this is not a duplicate, please edit your question to include a [mcve] that shows a particular problem that you encounter. – trashgod Jul 22 '17 at 11:46

1 Answers1

0

To have an idea of what can be changed in the current Look and Feel, you can try:

UIManager.getDefaults().entrySet().stream().sorted((o1, o2) -> {
    return o1.getKey().toString().compareTo(o2.getKey().toString());
}).forEach(entry -> {
    System.out.print(entry.getKey());
    System.out.print(" ---> ");
    System.out.println(entry.getValue());
});
thgw
  • 101
  • 3