title: How can i load data from text file to Jlist in java swing?
body: <p>I'm learning java. I have trouble when I click JButton to load data from text file to JList, but it notices error "java.lang.NumberFormatException: For input string: """. First of all, I input data from 4 JTextField to JList then save file text. My txt file has content: 1-java-3-4. Someone help me, please. Thank. Here is my code button save and load data:</p>
  
  <pre><code>private void btAddBookActionPerformed(java.awt.event.ActionEvent evt) {  
  String BookId = txtBookID.getText();
              String BookName = txtBookName.getText();
              String Quantity = txtQuantity.getText();
              String Price = txtPrice.getText();
              if(BookId.equals("")|| BookId.equalsIgnoreCase("Type Here") || BookName.equals("")|| BookName.equalsIgnoreCase("Type Here") || Quantity.equals("")|| Quantity.equalsIgnoreCase("Type Here")||Price.equals("")|| Price.equalsIgnoreCase("Type Here")){
                  txtBookID.setText("Type Here");
                  txtBookName.setText("Type Here");
                  txtPrice.setText("Type Here");
                  txtQuantity.setText("Type Here");
              }else{
                  listmodel.addElement(BookId+"-"+BookName+"-"+Quantity+"-
  "+Price);
                  booklist.setModel(listmodel);
                  txtBookID.setText("");
                  txtBookName.setText("");
                  txtQuantity.setText("");
                  txtPrice.setText("");         
              }
  
  private void btLoadDBActionPerformed(java.awt.event.ActionEvent evt) {                                         
      BufferedReader br = null;
      try{
          br = new BufferedReader(new FileReader("BookList.txt"));
          int val = Integer.parseInt(br.readLine());
          for (int i = 0; i &lt; val; i++) {
              String ss = br.readLine();
              listmodel.addElement(ss);
          }
          booklist.setModel(listmodel);
      }
      catch(Exception e){
          System.out.println(""+e);
      }
      finally{
          try{
              br.close();
          }
          catch(Exception e){
              System.out.println(""+e);
          }
      }
  }     
  </code></pre>