title: java change size of Textfield
body: <p>I want to make a frame where you have to enter your name and stuff. I try to make it like, name: <em>textfield</em>, next line, age: <em>textfield</em> and so on... But the textfield is really high. If I add 2 textfields in one panel in the frame, one textfield contains half of my screen. I try to fix this with a layout manager but I have no idea how.</p>
  
  <p>Could someone please help me?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.event.*;
  import java.awt.*;
  
  class GUI{
      public static void main(String [] args){
          GUI g = new GUI();
          g.Start();
      }
  
      public void Start(){
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
          frame.setSize(640, 640);            
          JPanel panel = new JPanel();
          JPanel west = new JPanel();         
          JLabel name = new JLabel("Name: ");
          JLabel age = new JLabel("Age: ");           
          JTextField field1 = new JTextField();
          JTextField field2 = new JTextField();           
          west.setLayout(new BoxLayout(west, BoxLayout.Y_AXIS));
          west.add(name);
          west.add(age);      
          panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
          panel.add(field1);
          panel.add(field2);          
          frame.getContentPane().add(BorderLayout.CENTER, panel);
          frame.getContentPane().add(BorderLayout.WEST, west);
          frame.setVisible(true);
      }
  }
  </code></pre>