|
Java™ by example!
|
|
|
How do I change the color of my JSlider component?
The JSlider component consists of several subcomponents (ticks, lines, labels, knob, ...). Look at the plaf UI source code (eg. javax.swing.plaf.basic.BasicSliderUI) and you'll notice that several times Color.black is hardcoded. So unless you rewrite a custom UI class for your JSlider, you will only be able to partially control the overall color. This following example shows you how to set the JSlider fore and background color as well as the fore and background color for the labels. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|