title: Java: How to add a button to a frame?
body: <p>I try to just use a add.method to add a button to a frame. But only the frame pops up.
  I don't see any buttons.</p>
  
  <pre><code>import javax.swing.*;
  public class okd {
      public static void main() {
          JFrame frame = new JFrame();
          JButton b1 = new JButton();
          frame.setSize(500,500);
          frame.add(b1);
          b1.setSize(400,400);
          b1.setVisible(true);
          frame.setVisible(true);
      }
  }
  </code></pre>