title: Getting double values out of a jtable
body: <p>I found a few threads with a similar problem, but nothing worked for me.
  I'm trying to get a double and a string value out of a jtable.
  I'm using the DefaultTableModel and did override the getCOlumnClass method:</p>
  
  <pre><code>private void initTable()
  {
      String tableColumns[] = { language.getTranslatedPhrase(MultilanguageUtil.Amount),
              language.getTranslatedPhrase(MultilanguageUtil.Ingredient),
              language.getTranslatedPhrase(MultilanguageUtil.Unit) };
  
      tableModel = new DefaultTableModel(tableColumns, 0) {
          private static final long serialVersionUID = 1L;  
           @Override
          public Class&lt;?&gt; getColumnClass(int column) {  
                  switch (column) {  
                      case 0:
                          return Double.class;
                      case 1:  
                          return String.class;
                      case 2:  
                          return Units.class; 
                      default:
                          return String.class;
                  }  
         }
      };
  
  
      table = new JTable(tableModel);
  </code></pre>
  
  <p>I'm expecting double values in the first column, but when i try to get a value with:</p>
  
  <pre><code>int rowCount = tableModel.getRowCount();
  
  for (int i = 1; i &lt;= rowCount - 1; i++)
  {
      double doubleValue = (Double) tableModel.getValueAt(i, 0);
  }
  </code></pre>
  
  <p>I get this exception:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>Object objValue = tableModel.getValueAt(i, 0);
          double doubleValue = ((Double) objValue).doubleValue();
  </code></pre>
  
  <p>but i get the same exception.</p>
  
  <p>when i excecute </p>
  
  <pre><code>System.out.println(table.getColumnClass(0));
  </code></pre>
  
  <p>it says </p>
  
  <pre><code>class java.lang.Double
  </code></pre>
  
  <p>so, it seems to be right, but i still get the exception, which says that its an integer, and i can't cast it to a double...</p>
  
  <p>I hope someone could help me, and sorry for my bad english!(not my first language)</p>