How could an image type be used in bean. My bean reflects a profile of a person which has a set of string and their profile picture. I am not sure about the type for the getter and setter methods for the image type data.
private Image image; //what replaces Image?
public void setImage(TYPE image) {
this.image= image;
}
public TYPE getImage() {
return Image;
}
please note I want to store displayable object, and using the get method in another class to display the image.
You should probably use Icon
(or ImageIcon
). To display an image in a swing app, the easiest way is to use a JLabel
and construct it with an Icon
. So that's probably what your bean should contain.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.