title: Java SWT - Adding buttons to shell
body: <p>I'm trying to create a simple window with a push button using the following code:</p>
  
  <pre><code>public static void main(String[] args) 
  {       
      Display display=new Display();
      Shell shell=new Shell();
  
      shell.open();
      shell.setText("Hi there!");
      shell.setSize(500,500);
  
      Button pushButton = new Button(shell, SWT.PUSH);
      pushButton.setText("Im a Push Button");
      //pushButton.pack();
  
      while (!shell.isDisposed()) {
          if (!display.readAndDispatch()) {
              display.sleep();
          }
      }
  
      shell.dispose();
  }
  </code></pre>
  
  <p>When commenting out the "pushButton.pack()" line, the button will not appear on the window.
  Is it really necessary to call the pack() method for every button I want to add?<br>
  What if I have 10 buttons?</p>
  
  <pre><code>for (int i=0; i&lt;10; i++) {
      new Button(shell, SWT.RADIO).setText("option "+(i+1));
  }
  </code></pre>
  
  <p>How will it then work?</p>
  
  <p>Plus,
  is there a good SWT tutorial for beginners online?<br>
  Can you recommend a book that can guide me through SWT?</p>