title: How to add image to JTable cell?
body: <p>I have a JTable that was created in Netbeans's design mode. In my code, I opted for placing the following line of code on startup:</p>
  
  <pre><code>model = new TableModel();
  tbShares.setAutoCreateColumnsFromModel(false);
  tbShares.setModel(model);
  </code></pre>
  
  <p><code>tbShares</code> is my JTable object.</p>
  
  <p>The JFrame that contains my JTable is shown below:</p>
  
  <p><img src="https://i.stack.imgur.com/NCrI3.png" alt="share manager"></p>
  
  <p>The first column was set as an <code>Object</code> type (the other two are Strings), so it can show an image. I have this code that I typed up for it to load an image, but it's not working (the <code>list.add</code> part, the rest is to give you an insight on how my code is structured). This is the extension of an <code>AbstractTableModel</code>.</p>
  
  <pre><code>public void addRegister(String status, String name, String clients){
          ImageIcon activeStatus = new ImageIcon(CleanSheets.class.getResource("res/img/active.png"));
          ImageIcon inactiveStatus = new ImageIcon(CleanSheets.class.getResource("res/img/inactive.png"));
          list.add(new Register((status.equals("true") ? activeStatus : inactiveStatus), name, clients));
          this.fireTableDataChanged();
      }
  
      class Register{
          Object status;
          String name;
          String clients;
  
          public Register(Object status, String name, String clients) {
              this.status = status;
              this.name = name;
              this.clients = clients;
          }
      }
  </code></pre>
  
  <p>Supposedly, it grabs the images from the folder I indicated, but then it's just outputting text in that column instead of the actual image. How do I get it to show the correct image? Thank you.</p>