문제

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