This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JSlider with decimal point increments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JSlider with decimal point increments" Watch "JSlider with decimal point increments" New topic

JSlider with decimal point increments

Jody Monahan

Joined: Feb 10, 2010
Posts: 20
Hi all,

I was just wondering if it is possible to set a JSlider with a minimum of '0' and a max of '1' with increments of lets say '0.1'?

I have obviously tried the following code, however it displays only one label - '0' and only one tick, also at '0'.

Any help would be greatly appreciated.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
not sure if there's any new inbuilt way to do it, but here's the old way

wood burning stoves
subject: JSlider with decimal point increments
Similar Threads
what accounts for precision problems when computing floating point numbers?
JSlider value
background bleed-through when using getInsets.
Array value
How to display labels on a JSlider