I want to use the 2D Java API to draw on a JLabel that already has an image on it and then save the resulting edited picture.
I can't find any tutorials on this specific subject, does anyone have any code or references that show how to do it?
override the paintComponent
method of the JLabel
. It should first call super.paintComponent
, so you get whatever the JLabel
contains, then add your own drawing code after that. Should look somewhat like this:
public void paintComponent(Graphics g){
super.paintComponent(g)
g.drawWhatever ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With