slider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
int val = slider.getValue();
for(int x = 0; x < image.getWidth(); x++) {
for(int y = 0; y < image.getHeight(); y++) {
image.setPixel(x, y, image.getPixel(x, y).brighter());
frame.repaint();
}
}
}
});
So this is my ChangeListener which I use to change the brightness of the image. It works decent and the image gets brighter. The problem I'm having is that it doesn't matter what way I move the slider because it gets brighter either way. The way I want it work is that the image should only get brighter when the slider is moved to the right.