Around March I designed a JComponent to manipulate a gradient. It's similar to a JSlider, except instead of 1 thumb it can have indefinitely many thumbs. (But it must always have a minimum of 2 thumbs.)
Each thumb can have the keyboard focus, and when it has the focus the arrow keys nudge it in the appropriate direction. Also this project by default is wired together with the ColorPicker project, so if you double-click or right-click a thumb the ColorPicker package is used to let you select/edit your color.
New thumbs are added simply by clicking inside the track of the slider. This is a property that you can turn off, if you really want to, but by default it is on. You can remove thumbs either by dragging them outside of the track, or by hitting the delete/backspace key when that thumb has focus. (Unless you are down to only 2 thumbs: then you can't remove any more.)
Here is a demo applet:
|To use it, try clicking on any spot in the applet to create a new color/thumb. Then you can right-click a thumb to trigger a popup to pick the exact color you want. If you double-click or press the spacebar the |
(As an applet, this demo may look a little unsightly when you invoke a popup or a dialog. And the keyboard focus may not easily transfer back to the applet when the dialog is dismissed. I recommend running this as a stand-alone app for a much better experience.)
This demo (source included) is available here.
As you can see there are a few customizations you can make to its appearance, too: