title: How can I add an image column to a table in wicket framework?
body: <p>I want to add a column containing images in each cell of a table in wicket framework. I make the table in a java class and have a createColumns() method as the following:</p>
  
  <pre><code>private List&lt;IColumn&gt; createColumns() {
      List&lt;IColumn&gt; columns = new ArrayList&lt;IColumn&gt;();
      // Create the columns that will be displayed, second param is the sort
      // order
      // Use column position for aggregate functions
      // Otherwise the query uses column aliases so these need to match here
  
      columns.add(new PropertyColumn(new Model("Status"), "code") {
          private static final long serialVersionUID = 1L;
          @Override
          public void populateItem(Item item, String componentId, IModel model) {
              Object[] values = ((ArrayWrapper) model.getObject()).getArray();
              setStatus((Integer) values[0]);
              item.add(new Image(componentId, new ResourceReference(this.getClass(), getStatus())));
          }
      });
  
      columns.add(new PropertyColumn(new Model("First"), "2", "array[1]"));
      columns.add(new PropertyColumn(new Model("Last"), "3", "array[2]"));        
      columns.add(new PropertyColumn(new Model("Sender"), "sender",
              "array[4]"));
      columns.add(new PropertyColumn(new Model("Receiver"), "receiver",
              "array[5]"));
  
      columns.add(new HeaderlessColumn() {
          private static final long serialVersionUID = 1L;
  
          public void populateItem(Item cellItem, String componentId,
                  IModel rowModel) {
              cellItem.add(new ActionPanel(componentId, rowModel));
          };
      });
  
      return columns;
  }
  </code></pre>
  
  <p>The html file is simply as the following:</p>
  
  <pre><code>&lt;html xmlns:wicket="http://wicket.sourceforge.net/"&gt;
  &lt;body&gt;
  &lt;wicket:extend&gt;
   &lt;table align="center" wicket:id="results"&gt;&lt;/table&gt;
  &lt;/wicket:extend&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But I get an exception which is:</p>
  
  <blockquote>
    <p>org.apache.wicket.markup.MarkupException: Component cell must be applied to a tag of type 'img', not '' (line 0, column 0)</p>
  </blockquote>
  
  <p>And it's related to the lines that I make the column for image. Can anyone help me how I can make it?</p>