Pergunta

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);
}
}
Foi útil?

Solução

Use Color#getRGB

int rgbColor = jccChooser.getColor().getRGB();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top