Graphics2d on JPanel
I want to make a programm in java that dropps a square at the position of your mouse. For that I wanted to draw a grid as background and then add the squares but as soon as I add a new component to the JFrame the background disappers. This also happens the other way around so if I add a Square and then add the Background the square disappers. The following is the code. My Question is now how I can add the second Graphic without the first one disapiring. I’m also sorry if my english isn’t that great it is not my native language.