I have a PNG image and I want to use it as a brush.
I want to paint something to JPanel
.
How to load an image to use as a brush for JPanel
?
I have a PNG image and I want to use it as a brush.
I want to paint something to JPanel
.
How to load an image to use as a brush for JPanel
?
final Image image = new ImageIcon("C:/images/image.png").getImage();
JPanel panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
g.drawImage(imageToPaint,
(desired x location), (desired y location), null);
}
};