title: Java Swing JFrame Layout
body: <p>I just wrote a simple code where I want a textfield and a button to appear on the main frame, but after running all I see is the textfield.</p>
  
  <p>If I write the code of the button after the textfield then only the button is displayed.</p>
  
  <p>Any idea why?</p>
  
  <pre><code>    JFrame mainframe=new JFrame();
      mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      mainframe.setBounds(0,0,200,200);
      JButton jb=new JButton();
      jb.setText("Leech");
      mainframe.add(jb);
      JTextField link=new JTextField(50);
      mainframe.add(link);
      mainframe.pack();
      mainframe.setVisible(true);
  </code></pre>