title: How to start something on a new line in Java SWING?
body: <p>I am trying to set my JTextArea to take up the max horz length of the screen, so that the next thing, in this case a button, will start on a new line, but I have no clue how to do it. I have messed around by setting the size of the JTextArea to change from, say, 20 to 1000 but that does not do anything. </p>
  
  <p>How can I get my textarea to take up the entire first row and then have the next item that I add to begin on the following row? Here is what I have so far...</p>
  
  <pre><code>MyFrame(){//constructor
  
          super("Simple Calculator");
          p = new JPanel();
          grid = new GridLayout(4, 4, 3, 3);
          p.setLayout(grid);
          setSize(400, 500);
          setResizable(true);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setUpTextScreen();
          //create buttons
          for(int i = 0; i &lt; buttonValues.length; i++){
              p.add(new JButton(buttonValues[i]));
          }
          add(p);
          setVisible(true);
      }
  
      private void setUpTextScreen() {
  
          textOnScreen = new JTextArea(7, 1000);
          textOnScreen.setText("0");//default
          textOnScreen.setEditable(false);
          p.add(textOnScreen);
      }
  </code></pre>