This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes slider problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "slider problem" Watch "slider problem" New topic
Author

slider problem

shanaya dutt
Greenhorn

Joined: Jul 02, 2009
Posts: 23
I need my slider to show each integer value from 1 to 800000.However each time i move the slider the next value after 1 it reads is 1372.i don't know why?

here's the code snippet


please tell me where I'm going wrong and what should i do?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I need my slider to show each integer value from 1 to 800000.

you have a 3-mile wide screen?

> However each time i move the slider the next value after 1 it reads is 1372.i don't know why?

wild guess, 1372 represents 1 pixel or slider.maxValue/slider track width (something like that, anyway)
shanaya dutt
Greenhorn

Joined: Jul 02, 2009
Posts: 23
so,is there any way i can show each value?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> is there any way i can show each value?

a very wide screen,
or you could use a smaller number, 8000, setting your own label to look like
majorTickSpacing of 100000, then multiply the slider's value x 100
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

I think you can still use the original range for the slider, but Michael is right about the tick spacing. Use larger intervals, like 10000 for minor and 100000 for major. Also, you'll probably have to change the preferred size.

I tried the following and after resizing a bit manually, it worked just fine:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: slider problem