• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

on select change image in wicket

Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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")));


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(

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

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

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


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

return p;

Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!