• 0

[Java] UIManager? Changing the look of components throughout program


Question

I'm very new to Java and I'm trying to create a nice user interface.

So far, I have been changing the colour of buttons and everything separately - changing the properties for each one. This has become very tedious.

I searched around and found somewhere which said you could change the background for all of the buttons and other components throughout the whole program using the UIManager. I searched around about the UIManager but I have found nothing which explains to me how I would go about setting up this UIManager to just simply say "all buttons have this background colour", "all textboxes have this font and colour", etc. I just don't understand this UIManager at all.

If anybody could help me and aid me in setting this up, I'd appreciate it a lot.

Thanks in advance.

EDIT -

It's the following quote from this link I was referring to.

There can be different ways to do this. Since your requirement is to set the pressed state background color for ALL buttons in your application- you can set it into the UIDefaults, right at the beginning when you initialize your GUI.

Just add this at the start of your UI creation method.

UIManager.put("Button.select", Color.black);

I don't understand what this means but it sounds like something which can be done easily.

If anybody could help me understand this and understand how to do it, I would really appreciate it.

Edited by Calum
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Sorry about the late reply to this - I got extremely held up with a few assignments, but I did look at your link and it was very useful. Thank you very much for your help :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.