Question

How can I get the color of the JColorChooser in rgb so I can save it to MySQL and use it to my Label when I want to use it?

My current doesnt give the specific number instead it gives me the output of

java.awt.Color[r=102,g=204,b=0]

Is there a way of getting just the rga number?

class GetColorChooser implements ChangeListener{

public void stateChanged(ChangeEvent e) {
    String lol = jccChooser.getColor().toString();
    System.out.print(lol);
}
}
Était-ce utile?

La solution

Use Color#getRGB

int rgbColor = jccChooser.getColor().getRGB();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top