I need make a program like a RGB selector, i have the sliders(sliderR, sliderG, sliderB) in my window, but i don't know how make that the sliders change the color instantly, the only i have is the following sliders code:
sliderR.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent ce) {
int x = sliderR.getValue();
int y = sliderG.getValue();
area.setText("value = \n\n "+x);
Color ColorR = new Color(x,y,0);
area.setBackground(ColorR);
}
});
But, this code only varies for sliderR, the sliderG is static. How i can fix this problem?