Java - How can I create  a double JSlider? (does one exist?)

Posted on 2006-07-05
Last Modified: 2010-05-18
I need a slider that will allow the user to specify an interval. So, instead of having one marker like the Swing JSlider, it should have two: one to specify the minimum and another to specify the maximum value.

Here I have a visualization of what I'm talking about (I don't know if it exists, I photoshopped it):

 I know that with some extra code I could have two JSliders perform this function (by having one dedicated to selecting the min. value and another to the max., and not allowing them to cross) - but for stylistic reasons, I need the two markers to be on the same slide rule.

Thanks in advance for any advice on this matter!
Question by:spyderhydrant
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 35

Expert Comment

ID: 17052832
I do not think you can do it. What you can do is to define the maximum and minimum values of the JSlider.

Author Comment

ID: 17052909
Well someone's done it, I'm guessing. I'll hack the source for the JSlider class if I have to. But I don't want to reinvent the wheel if it's not necessary. I'm wondering if there is some open source extension of swing (or something else open source all together) which might provide this implementation? It just seems like something a lot of programs could make use of (such as clipping video or audio).
LVL 35

Accepted Solution

girionis earned 350 total points
ID: 17052978

Author Comment

ID: 17053048
Aha! Thank you, thank you, thank you. =)
LVL 35

Expert Comment

ID: 17053069
Thank you for accepting :) Try it and let me know if this is not what you are looking for and then we can try to hack it.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse buid path vs tomcat lib path 10 49
Is there a simpler dropbox system? 10 53
swing controls 2 37
jsp error 6 70
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question