File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes on select change image  in wicket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "on select change image  in wicket" Watch "on select change image  in wicket" New topic
Author

on select change image in wicket

Layla Rashid
Ranch Hand

Joined: Dec 25, 2006
Posts: 36
Hi
I am new in wicket.
In a page I am showing a list of person. If I select a person , his information shows up including his picture.
I want to write a method , where, If I have no image it will show noImage.jpeg, If I have stored image it will show that image ,( it will change the image when I select that person from a person list ) and if don't have stored image but have twitter image it will show twitter image , when I select a person.
in my code , noImage and twitter image is showing up but I cannot display the stored image.

--------------------------------------------

WebMarkupContainer markup = new WebMarkupContainer("image");
markup.add(new AttributeModifier("src", true, new PropertyModel<Void>(
this, "image")));
add(markup);

----------------------------------------------

public ImageIcon getImage() {

ImageIcon p = null;

try {

if (selected == null) {
ImageIcon img = new ImageIcon("../noImages.jpeg");
p = img;
} else {

byte[] imageBytes = participantService.retrieveImage(selected);
if (imageBytes != null) {
BufferedImage img = ImageIO.read(new ByteArrayInputStream(
imageBytes));


java.awt.Image tagImg = img.getScaledInstance(80, 100, 100);


ImageIcon imgIcon = new ImageIcon(tagImg);



p = imgIcon;

} else {

if (selected.getTwitterUserAccount() != null) {
URL url = adminTwitterService.getProfileImage(selected
.getTwitterUserAccount());

ImageIcon img = new ImageIcon(url);
p = img;

}else{
ImageIcon img = new ImageIcon("../_img/images.jpeg");
p = img;
}
}

}

} catch (Exception e1) {
getSession().error(e1.getMessage() + "");
}

return p;

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on select change image in wicket
 
Similar Threads
still memory problem with image loading
repainting issue
how to change the ImageIcon of a JLabel?
about setIconImage()
Adding background image to JDesktopPane