title: How to add JComponents via .txt file
body: <p>I'm trying to add a JComponent based on what's in the .txt file
  for example</p>
  
  <p>inside Component.txt</p>
  
  <pre><code>"[button]
  buttonName
  buttonText
  Location(x,y)"
  </code></pre>
  
  <p>so how can i make a JButton named as buttonName, with a text of buttonText at the location x &amp; y</p>
  
  <p>here's my code:</p>
  
  <pre><code>private void btnRetrieveActionPerformed(java.awt.event.ActionEvent evt) {                                            
      String filename=txtFilename.getText()+".txt";
      int x=1;
      String text=null;
      String bname=new String(),btxt;
      double bsizex,bsizey,blocx,blocy;
  
      try (BufferedReader fw = new BufferedReader(new FileReader(new File(filename))))
      {
          String s;
          while((s = fw.readLine()) != null)
          {
              if(s.equals("[button]"))
              {
                  String btnName = fw.readLine(); //read the next line after [a]
                  JButton button1=new JButton(btnName);
                  this.add(button1);
              }
          }
      }catch(IOException e)
      {
          e.printStackTrace();
      }
  }                                           
  </code></pre>