I'm writing a Java Swing program that needs to enable the user to select 8 different colors from a Settings form. This is quite straightforward as far as it goes with JColorChooser, but I'm wondering is there a recommended way to lay out the form. This is what I'm currently contemplating:
For each color,
Display a square in the current selected color,
Display to the right of that, a button that will bring up the JColorChooser to change the selected color.
However, I suspect the 8 buttons will make the form look clunky if not downright ugly (particularly if more get added later). An alternative approach might be to make the square double as the button; in that case, how to visually indicate it's clickable?
Is there an alternative recommended method?
Here is a
ColorButton
that I use in the pscode API.Screenshot
Screenshot of typical usage.
In Other News..
That part of the layout (for the 5 buttons and check box) is using a
GridLayout
. You might also alter the size of the buttons by:body
element of the HTML.DukeBox (from which that screenshot was obtained) uses the native PLAF - I'm running Windows 7.
As an alternative, consider implementing the
Icon
interface and using the icon on the button. Together,PieceButton
andColorIcon
comprise an example.