title: ask : error to show Jtable from database with java.lang.NullPointerException
body: <p>i've run my main method </p>
  
  <pre><code>package com.dascom.view;
  
      public class Main {
  
          public static void main(String[] args) {
  
              new JFrameDatabarang().setVisible(true);
  
          }
  
      }
  </code></pre>
  
  <p>and get error </p>
  
  <pre><code>        Connection succes
          Exception in thread "main" java.lang.NullPointerException
              at com.dascom.controller.DatabarangController.isiTable(DatabarangController.java:54)
              at com.dascom.view.JFrameDatabarang.&lt;init&gt;(JFrameDatabarang.java:130)
              at com.dascom.view.Main.main(Main.java:7)
  </code></pre>
  
  <p>this is at DatabarangController.java:54</p>
  
  <pre><code>frameDatabarang.JtableDatabarang().setModel(dtm);
  </code></pre>
  
  <p>on my DatabarangConroller class </p>
  
  <pre><code>public class DatabarangController {
  
  
          JFrameDatabarang frameDatabarang;
          Databarangimpl databarangimpl;
          List&lt;Databarang&gt; listDatabarang;
  
  
      public DatabarangController(JFrameDatabarang frameDatabarang)  {
      this.frameDatabarang = frameDatabarang;
      databarangimpl = new DatabarangDAO();
      listDatabarang = databarangimpl.getByAll();
  
      }
  
  
      public void isiTable() {
              listDatabarang = databarangimpl.getByAll();
              DatabarangTabelModel dtm = new DatabarangTabelModel(listDatabarang);
              frameDatabarang.JtableDatabarang().setModel(dtm);
  
          }
      }
  </code></pre>
  
  <p>this is JFrameDatabarang.java:130</p>
  
  <pre><code>databarangController.isiTable();
  </code></pre>
  
  <p>in </p>
  
  <pre><code>    public JFrameDatabarang() {
      initcomponent();
  
      databarangController = new DatabarangController(this);
      databarangController.isiTable();
  
      JtableDatabarang = new JTable();
      JtableDatabarang.addMouseListener(new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
              databarangController.isiField(JtableDatabarang.getSelectedRow());
  
  
          }
      });
      JtableDatabarang.setBounds(17, 384, 599, 136);
      contentPane.add(JtableDatabarang);
  
      }
  </code></pre>
  
  <p>@Katja
  i put jtableDatabarang include in public JframeDatabarang() </p>
  
  <p>so. after i put recomend as @katja and @Denish.</p>
  
  <p>the JFrameDatabarang is run. and i try to put a value in JFrameDatabarang.</p>
  
  <p>i got error </p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
  at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
  at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
  at java.lang.Double.parseDouble(Double.java:538)
  at com.dascom.controller.DatabarangController.insert(DatabarangController.java:74)
  at com.dascom.view.JFrameDatabarang$3.actionPerformed(JFrameDatabarang.java:235)
  </code></pre>
  
  <p>this is DatabarangController.java:74</p>
  
  <pre><code>databarang.setHargajual(Double.parseDouble(frameDatabarang.JtextHargajual().getText()));
  </code></pre>
  
  <p>on DatabarangController class i make a method insert </p>
  
  <pre><code>public void insert()   {
      Databarang databarang = new Databarang();
  
      databarang.setNamabarang(frameDatabarang.JtextNamabarang().getText());
      databarang.setStok(Integer.parseInt(frameDatabarang.JtextStok().getText()));
      databarang.setHargajual(Double.parseDouble(frameDatabarang.JtextHargajual().getText()));
      databarang.setHargabeli(Double.parseDouble(frameDatabarang.JtextHargabeli().getText()));
      databarang.setSatuanukuran(frameDatabarang.JtextSatuanukuran().getText());
      databarang.setDeksripsi(frameDatabarang.JtextDeskripsi().getText());
      databarang.setKeterangan(frameDatabarang.JtextKeterangan().getText());
  
      databarangimpl.insertDatabarang(databarang);
  }
  </code></pre>
  
  <p>i try to search a topic in same error with me in stackoverflow on</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
  </code></pre>
  
  <p>nothing get the solution.</p>