Вопрос

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);
}
}
Это было полезно?

Решение

Use Color#getRGB

int rgbColor = jccChooser.getColor().getRGB();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top