Modify Swing’s Default Values

Modify Swing’s Default Values

A previous tip, “Get a Hold of Swing Defaults,” shows how to obtain the default settings for Swing components. It is easy to change any default settings programmatically. For example, Swing scrollbars have a purplish thumb. In fact, if you get the default value for “ScrollBar.thumb”, you’ll notice that it has a default setting of:


To change the purplish thumb to a light gray thumb, you should first obtain a reference to javax.swing.UIDefaults ( for Swing 1.03 and below) as in:

 javax.swing.UIDefaults uid = javax.swing.UIManager.getDefaults();

UIDefaults is an extension of ava.util.Hashtable class, so next you’ll write:

 uid.put("ScrollBar.thumb", java.awt.Color.lightGray);

Note that the changes to Swing’s default settings will take effect prior to creation of Swing components by your code.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular