This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
ima is an Image, not an Icon. Check out what methods your "icon" variable has, then use that variable in the call to setIcon.
This would have been easier to find out if you would have posted the error as I has asked you. Now I'm actually guessing this is the problem (but it probably is).
Joined: Nov 02, 2009
I have done much work over it . I m getting the image on other frame from Jfilechooser and from that frame i have to crop the image and this image is showing in label
and now i want to crop some area of image so that i can use the image which is worth to me.
So i dont know how to crop the image in cropImage() function i m doing the croping but i dont how to do it and at last when the crop is compelete i want to put the cropped image at other label from where i can save it in database i think now this is clear so now pleasehelp me
ima is an Image. image is a JLabel. It's setIcon method requires an Icon. Is Image compatible with Icon? I don't think so. Is there some class or object that is? Yes there is, and you even have an instance of that: icon.
Can you find a method of icon that allows you to change its image? I'm sure you can. Once you've done that I'm sure you'll be able to set the Icon of image. After all, you then have an Icon with the cropped image.