I try to flipp a imge but DrawImage method is not working. here is my code and please help me.
public void flipping() {
if (InnerFrame.frame5.getComponentListeners() != null){
Graphics2D g;
BufferedImage img = new BufferedImage(InnerFrame.L.getIcon().getIconWidth(), InnerFrame.L.getIcon().getIconHeight(),BufferedImage.TYPE_INT_RGB);
int w = img.getWidth();
int h = img.getHeight();
g = img.createGraphics();
g.fillRect(0,0,InnerFrame.L.getWidth(), InnerFrame.L.getHeight()); // draw a rectangle to avoid black background
g.drawImage(img, 0, 0, w, h, 0, h, w, 0, null); // THIS LINE IS NOT WORKING !! Need help
InnerFrame.L.paint(g);
ImageIcon im = new ImageIcon(img);
InnerFrame.L.setIcon(im);
}
}