0

How to remove Background of Jpanel while converting image (png). I tried following line to remove the background of the panel but The converted image background become black.

g2.clearRect(0, 0, getWidth(), getHeight());
eis
  • 51,991
  • 13
  • 150
  • 199
Visva
  • 194
  • 1
  • 3
  • 11

1 Answers1

0

draw a filled rectangle with the background color...

Color backGround = getBackGround();
g2.setColor(background);
g2.fillRect(0,0,getWidth(), getHeight() );
Martin Frank
  • 3,445
  • 1
  • 27
  • 47