The Source for Java Technology Collaboration
User: Password:



Tim Boudreau

Tim Boudreau's Blog

A Single-Mouse-Gesture Color Chooser for Swing

Posted by timboudreau on June 05, 2006 at 05:56 PM | Comments (1)

Ever needed a faster, slicker way to let your users select a color in Swing? I just set up a new java.net project, which produces just such a widget. Press the mouse and a palette pops up; drag over the palette and release when the color is right; use combinations of ctrl/alt/shift to switch palettes (palettes are pluggable if you want to write your own).

The widget is the Quick Color Chooser - net.dev.java.colorchooser.ColorChooser. It's a simple Swing widget with one property of interest - color - that is incredibly easy to use.

It's actually been sitting around in contrib/ on netbeans.org for a couple of years, and the palette code dates back to 2000 - it's a port of a Delphi component I wrote in the mid nineties. .

So the code is fairly mature and solid - I just split it out into having a separate UI delegate so it's more Swing-like and the painting behavior is overridable, but it's the same logic as before. Feedback appreciated.

If you want to try it using Matisse in NetBeans, there's a NetBeans module that installs the component in the component palette for immediate drag-and-drop use (created using BeanNetter). The module includes the javadoc.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Could you perhaps put together a Web Start or Applet demo?

    Posted by: mawcs on June 06, 2006 at 02:43 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds