following problem: i have an audio player which retrieves streams (mp3). the playback works fine, and the knob in the jslider moves as expected when the song plays.
but i want the user to be able to play forward and i want to display the user how much of the track has already been stored into ram.
any idea how i can achieve that? is there something already implemented in JSlider and i just didnt see it?
If I correctly understand what you mean by "play forward" then no.
It's not just the display of JSlider, its model (BoundedRangeModel) only caters to one 'value'. Visually representing both the present play position as well as the stream load status would require two values.
some sort of implementation could probably be achieved with a custom UI delegate that uses the BoundedRangeModel's extent to "fill" the track between the slider thumb I(the "play" position) and the "load" position but this would by its nature be LaF dependent. You could try extending BasicSliderUI (or MetalSliderUI, or ...) and overriding paintTrack(...) starting with a call to the super implementation, and adding code to paint the track between the slider thumb and (maximum - extent). Your user code would have to setExtent(...) of the JSlider accordingly.
This would have a probably positive spinoff in that it is not possible to drag a slider thumb beyond (maximum - extent) so would thus prevent the user from foraying into a region of the stream that hasn't yet been received.
There are no new questions, but there may be new answers.
Joined: Jun 20, 2009
yes you understood me.
Your answer sounds pretty hard to me - i'm not that java god like programmer ;)
I will take a look at BasicSliderUI
i am now able to draw a line... need further investigation how i can set the x y coordinates accordingly to the JSlider line and how to draw a "nice" line, not that strange thin thing, but this topic can be closed as it solved my problem, thanks ;)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com