0

Code to paint a picture to a panel:

public class MyDraw extends JPanel {
  background = new ImageIcon("src/background.jpg").getImage();
@Override
    protected void paintComponent(Graphics gr){
 super.paintComponent(gr);
 gr.drawImage(background, 0, 0, 800, 600,   null);

}
}

I want to not to paint a the background picture in this circle, because I want to see the objects behind this circle. I don't want to put the object the front of the image, becuse the circle would move by pressing WASD.

Like this: see image by clicking here.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
ElsaKombat
  • 19
  • 2
  • [This answer](https://stackoverflow.com/a/6296381/418556) shows how to draw an image within a shape (of text). Use an `Ellipse2D` instead of the shape used in that example. – Andrew Thompson Dec 28 '20 at 14:14
  • [What is the XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – Gilbert Le Blanc Dec 28 '20 at 14:23

0 Answers0