title: java - how to get object inside cell in jtable
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7036036/adding-multiple-jprogressbar-to-tablecolumn-of-jtable">Adding multiple JProgressBar to TableColumn of JTable</a>  </p>
  </blockquote>
  
  
  
  <p>i have a <code>jTable</code> with a <code>DefaultTableModel</code> with this coloumn:</p>
  
  <pre><code>String String JProgressBar
  </code></pre>
  
  <p>and every row is created like this:</p>
  
  <pre><code>progress.add(getProgress(x, total));
  d.addRow(new Object[]{category, "Initializing..", progress.get(work)});
  </code></pre>
  
  <p>Where getProgress is:</p>
  
  <pre><code>private JProgressBar getProgress(int x, int total) {
          JProgressBar progressCsv = new JProgressBar();
          progressCsv.setMaximum(totale);
          progressCsv.setStringPainted(true);
          progressCsv.setString("0%");
          return progressCsv;
  }
  </code></pre>
  
  <p>And progress:</p>
  
  <pre><code>progress = new ArrayList&lt;JProgressBar&gt;();
  </code></pre>
  
  <p>My class implements TableCellRenderer so </p>
  
  <pre><code>@Override
      public Component getTableCellRendererComponent(JTable jtable, Object o, boolean bln, boolean bln1, int i, int i1) {
          int v = Integer.parseInt(o.toString());
          JProgressBar b = (JProgressBar) jtable.getModel().getValueAt(i, i1);
          b.setValue(v);
          return null;
      }
  </code></pre>
  
  <p>Where <code>i</code> and <code>i1</code> are 0 - 2. so the first row and third coloum ( JProgressBar ).</p>
  
  <p>On:
     JProgressBar b = (JProgressBar) jtable.getModel().getValueAt(i, i1);
  i get </p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to javax.swing.JProgressBar
  </code></pre>
  
  <p>Where is the problem? can you help me?</p>