0

I am trying to fill a shape with an imageIcon and I keep getting an error saying that it should be converted to a paint. I am afraid I don't know how to do it. I have read quite a few examples from different sources but they are not using swing. The code below shows one of the ways I was trying to achieve that. Thanks in advance!

Circle cir2 = new Circle(250,250,120);
cir2.setFill(profileSidebar.getImage());
camickr
  • 321,443
  • 19
  • 166
  • 288
  • 1) For better help sooner, [edit] to add a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). 2) One way to get image(s) for an example is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556). E.G. The code in [this answer](https://stackoverflow.com/a/10862262/418556) hot links to an image embedded in [this question](https://stackoverflow.com/q/10861852/418556). – Andrew Thompson Feb 09 '21 at 22:08

1 Answers1

0

I keep getting an error saying that it should be converted to a paint.

Maybe you can use a TexturePaint.

According to the API you can use:

 TexturePaint paint = new TexturePaint(BufferedImage, Rectangle);
camickr
  • 321,443
  • 19
  • 166
  • 288