About Color picker

How to implement this gradient color picker

Hello @guankai ,

The simplest implementation would be to display an image of the gradient as is (only the central part), then use the readPixel of the GraphicsContext when you detect a click: GraphicsContext Javadoc.

Gaëtan for MicroEJ

Hello I Found the readPixel function in the document,but an new question, How to get GraphicsContext in handleEvent (when I click the picture)

Hello @guankai,

There is a readPixel() method directly in the class Image. So you don’t need the GraphicsContext.

The reason is that Images are immutable (we cannot draw on it). The GraphicsContext can only be retrieved for BufferedImages.

Kind regards,