Lokeshmsit 0 Newbie Poster

I have a JInternalFrame painted with a BufferedImage and contained in the DesktopPane of a JFrame.I also have a JTextArea where i want to write some java code (function) that takes the current JInternalFrame painted BufferedImage as an input and after doing some manipulation on this input it returns another manipulated BufferedImage that paints the JInternalFrame with new manipulated Image again!!.


Manipulation java code of JTextArea:-

public BufferedImage customOperation(BufferedImage CurrentInputImg)
{ Color colOld;
Color colNew;
BufferedImage manipulated=new BufferedImage(CurrentInputImg.getWidth(),
CurrentInputImg.getHeight(),BufferedImage.TYPE_INT_ARGB);

//make all Red pixels of current image black
for(int i=0;i< CurrentInputImg.getWidth();i++)
{ for(int j=0;j< CurrentInputImg.getHeight(),j++)
{
colOld=new Color(CurrentInputImg.getRGB(i,j));
colNew=new Color(0,colOld.getGreen(),colOld.getBlue(),colOld.getAlpha());
manipulated.setRGB(i,j,colNew.getRGB());

}
}

return manipulated;
}

so,how can i run/compile this JTextArea java code at runtime and get a new manipulated image for painting on JInternalFrame???????