Reputation: 129
I want to make a GUI object that will somehow function like a slider this slider has values that have the rage of rgb int and also show graphically show the color spectrum parallel to the slider so it should mixture of two pictures below
Spectrum
(source: whiterockscience.com)
Slider
(source: dreamincode.net)
and finally this graphical object should have the ability to be chosen multiple times so its quite different than actual slider hence the ticks for rgb int values .it means that the user can click on for example 4 different parts of spectrum and then the code will store the rgb int value of each click to an array how can I make something like this?
Upvotes: 0
Views: 255
Reputation: 177
JColorChooser is probably what you want in most instances it's easy to implement and easy to use. Is what you're wanting this?
If that's what you're looking for I think your best bet would be to draw images on a JPanel through paintComponents. Perhaps draw an image of a slider and draw a spectrum underneath it and get mouseListeners added to handle events when you have touched the spectrum picture or slider portion. To get a slider to grab the right color it would be something like this.
Another point of information that would be useful is to go into paint and check out how that slider works and see the RGB values and how they change.
Upvotes: 1