How to remove text over JSlider

I have JSlider in my GUI that goes from 0 to 100. For some reason, there is text above the position of the slider that displays the current value of the slider, and it follows my slider. Ie, if I moved the slider halfway, “50” will appear above where my slider is at the moment. However, I cannot understand what a text field is, all I know is its part of the slider.

I want to either delete it or change it to something else, how would I do it?

+5
source share
4 answers

I would just comment on etahuin's answer, but I don't have a reputation yet.

Anyway, call this before creating the JSlider:

UIManager.put("Slider.paintValue", false);

"V" paintValue.

, , UIManager, UIManager:

Iterator<Entry<Object, Object>> it = UIManager.getDefaults().entrySet().iterator();
while(it.hasNext())
    System.out.println(it.next());
+4

, . JSlider - static JPanel:

UIManager.put("Slider.paintValue", false);

.

+3

? , , ? , , setToolTipText( null ), setToolTipText( "My Text" ).

0

As I can see, in JSlider there is a setLabelTable parameter with a dictionary parameter. I have not used it, but I assume that if you install it in an empty dictionary (or empty labels for each possible value), no shortcuts will appear.

A better solution is to use setPaintLabels with a falsevalue.

-1
source

All Articles