I'm trying to do a small image processing with Java. The user should be able to load an image and add some easy modifications to the image by clicking a button.
Loading and displaying the image is no problem but when I try to make a binary image out of it the repaint() method makes me a black image on the screen.
I think the problem is with the repaint()-method. I already used the search function and Google but I still have no idea what's wrong in my code.
That's what I have so far:

After pressing the binary button, the a new instance of ImagePanel is assigned to the variable imagePanel. However, this new ImagePanel is not added to the JFrame. The old ImagePanel remains added to the JPanel.
–
gogognomeDec 27 '12 at 18:30

You are replacing the image panel instead of the image. Also, you're not performing the actual painting on the binary image. Here is an example how to convert the original image to a binary, it is based on the provided code: