Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24851
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JSlider interactions |
| Date | 2013-07-30 21:57 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-52F747.21570130072013@news.aioe.org> (permalink) |
| References | <81940cb0-8687-40f5-8eda-68bf8c8ff935@googlegroups.com> |
In article <81940cb0-8687-40f5-8eda-68bf8c8ff935@googlegroups.com>, FredK <fred.l.kleinschmidt@gmail.com> wrote: > Is there a way to set the block increment for a JSlider ? By this I > mean the change in value that occurs when the user clicks between the > current position and one of the ends (similar to the block or unit > increment for a JScrollBar). I can't find anything to do this in > JScrollBar or BoundedRangeModel. > > Or is it a UI-specific amount (I am using Nimbus). > > For an integer slider, I want to drag the knob to the approximate > position, and then be able to click near it to move one integer at a > time. It appears that the default amount is 10% of the range, so when > the range is from 0 to 40, clicking in the "trough" area moves the > value by 4. This handled by an instance of BasicSliderUI.TrackListener, for which you'll need a custom UI delegate, as shown here, <http://stackoverflow.com/a/518672/230513> and in How to Write a Custom Swing Component: <https://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html> Interestingly, BasicSliderUI.ScrollListener is public, apparently to work around an IE bug. As an aside, the API for each says. Instantiate it only within subclasses of . while the source says, Instantiate it only within subclasses of <Foo>. -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JSlider interactions FredK <fred.l.kleinschmidt@gmail.com> - 2013-07-30 14:24 -0700
Re: JSlider interactions "John B. Matthews" <nospam@nospam.invalid> - 2013-07-30 21:57 -0400
Re: JSlider interactions FredK <fred.l.kleinschmidt@gmail.com> - 2013-07-31 10:34 -0700
Re: JSlider interactions "John B. Matthews" <nospam@nospam.invalid> - 2013-08-01 17:50 -0400
csiph-web