title: Adding multiple sets of JLabel and JTextBox to the same line in Java
body: <p>I'm building an equation solver that allows the user to enter a system of equations and then get the answer. So, I need to build a GUI that allows the user to enter the set of equations. I decided to go about doing this from scratch. Here's what my code looks like:</p>
  
  <pre><code>private JFrame frame;
  private JTextField[][] text;
  private JLabel label;
  private JLabel equalLabel;
  private JLabel plusLabel;
  private JTextField answerText;
  
  private void displayGetEquations(int total)
  {
  frame = new JFrame("Enter Equations");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      equalLabel = new JLabel();
      equalLabel.setText(" = ");
      plusLabel = new JLabel();
      plusLabel.setText(" + ");
      answerText = new JTextField();
      answerText.setColumns(2);
      frame.setLayout(new GridLayout(0,10));
      text = new JTextField[3][3];
      for(int i = 0 ; i &lt; 3 ; i++)
      {
   panel = new JPanel();
              panel.setLayout(new FlowLayout());
          for(int j = 0 ; j &lt; 3 ; j++)
          {
              text[i][j] = new JTextField();
              text[i][j].setColumns(2);
              label = new JLabel();
              Font font = label.getFont();
              Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
              label.setFont(boldFont);
              label.setText("x");
              panel.add(text[i][j]);
              panel.add(label);
              panel.add(plusLabel);
          }
          panel.add(equalLabel);
          panel.add(answerText);
          frame.add(panel);
          frame.revalidate();          
          frame.repaint(); 
  
      }
      frame.pack();
      frame.setVisible(true);
  }
  </code></pre>
  
  <p>This is what I get when I run the above code: </p>
  
  <p><a href="https://i.stack.imgur.com/7Nife.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Nife.png" alt="What I get when I run the above code"></a></p>
  
  <p>But I am not getting the desired output, which, I would like to be something like this:
  <a href="https://i.stack.imgur.com/xDghJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xDghJ.png" alt="enter image description here"></a></p>
  
  <p>This was made using the <strong><em>drag and drop</em></strong> feature of <strong>NetBeans</strong>What am I doing wrong? Is what I want even possible? 
  Any help would be appreciated.
  Thanks !</p>
  
  <p>(This was made using the <strong><em>drag and drop</em></strong> feature of <strong>NetBeans</strong>)</p>