JSlider is a Java Swing component that lets the user graphically select a value by sliding a knob within a bounded interval.
Questions tagged [jslider]
381 questions
14
votes
2 answers
JSlider for doubles
I am making a GUI (using swing) for a poker framework and need some sort of slider to allow players to select a bet size. However the Swing JSlider only works with int values whereas I need something that can support doubles for 1 decimal point. Are…

Aly
- 15,865
- 47
- 119
- 191
13
votes
3 answers
JSlider question: Position after leftclick
Whenever I click a JSlider it gets positioned one majorTick in the direction of the click instead of jumping to the spot I actually click. (If slider is at point 47 and I click 5 it'll jump to 37 instead of 5). Is there any way to change this while…

E. Hall
- 181
- 2
- 10
10
votes
2 answers
Set the size of a JSlider thumb
How can the size of the thumb be configured for a JSlider?
With the defaults, and a range for the JSlider of 256, the thumb is only a few pixels wide, which makes it quite difficult to control with a mouse.
I am using the Windows 7 look and feel and…
user3317
9
votes
3 answers
Painting the slider icon of JSlider
Would like to repaint the the marker or the thumb of the JSlider instead of the standard gray. How can I achieve this?

Jeetesh Nataraj
- 608
- 2
- 8
- 20
9
votes
1 answer
Is this a bug in JSlider?
I've been having some problems using the JSlider class - specifically with tick labels.
The first time I use setMajorTickSpacing and setMinorTickSpacing everything works as expected. However, subsequent calls to setMajorTickSpacing update the ticks,…

charlemagne
- 735
- 7
- 14
7
votes
2 answers
How to check if value was set manually and not with setValue (JSlider, JSpinner)?
How can I check if the value of a JSlider or JSpinner was set via the graphical interface and not via the method setValue( int n) ?

andreihondrari
- 5,743
- 5
- 30
- 59
7
votes
3 answers
Using Java Dictionary...use a Hashtable?
I'm a bit surprised no one has asked about this specific case, cause it's kind of a weird inconsistency in the java standard libraries:
I'm using swing JSliders with custom labels; the only library call available to assign labels is:…

bcr
- 1,328
- 11
- 27
6
votes
2 answers
Remove value displaying over thumb in JSlider
I have a little problem with my JSlider, that I haven't been able to solve. To explain the situation a little, I have to do a JSlider going from 0 to 20, through 0.1 steps. I tricked my way out of problems by creating a JSlider from 0 to 200, and…

Valentin Rocher
- 11,667
- 45
- 59
6
votes
1 answer
JSlider : can't make the knob move on the closest tick during drag
As explained in the title, i made a simple JSlider, and i successfully setted a minimum and maximum value, and a minor tick spacing, then i setted the "setSnapToTicks" to true. No problem with that part, my knob move on the closest tick when the…
user2115176
6
votes
1 answer
Change the JSlider look and feel
I have gone through this website Change look and feel of JSlider
but except for Slider.altTrackColor nothing else is working. I want to do something like shown in pic1 any suggestion would be of great help. I'm working on JDK 1.6.
UIDefaults…

madhur
- 357
- 2
- 6
- 17
5
votes
3 answers
JSlider not updating?
I'm quite the beginner regarding the whole drawing stuff in windows and I'm kinda stuck at the moment. At the moment I'm just testing the things out.
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
public class test extends…

swebonny
- 63
- 1
- 6
5
votes
1 answer
JSlider rendering with custom LabelTable
I want to use a JSlider to browse some chronological events, so I set a custom LabelTable so that it displays some Dates instead of the default integer values. My code goes like this:
JSlider slider = new JSlider();
...
Date[] dates = getDates();
…

remi
- 3,914
- 1
- 19
- 37
5
votes
3 answers
Java Swing Range Slider U.I
I needed a slider with two knobs on it (representing a range) and I found this nifty one here. However, they created their own U.I. which extends Java's BasicSliderUI. They override the paint method to draw their own knobs. I would like to use…
Scott
4
votes
2 answers
Java/Swing Volume Slider
Part of my application has a media component, and I'm looking for a nice volume slider I can use rather than a JSlider which looks a bit ugly for this purpose (or specifically, an extended JSlider with custom visuals would be nice). I could write…

Michael Berry
- 70,193
- 21
- 157
- 216
4
votes
3 answers
Java JSlider precision problems
I have a list of N JSliders (N does not change procedurally, only as I add more features. Currently N equals 4). The sum of all the sliders values must equal to 100. As one slider moves the rest of the sliders shall adjust. Each slider has values…

reynman
- 709
- 3
- 9
- 19