Now I'm trying to have two text fields next to each other above each label that describes what this text field does. To do this, I placed them in GridLayout (2, 2). Is this the best way? This is the only way I know to have a shortcut directly above another component. Is there a better way? And if there is one shortcut over one button. Is it possible to position this through GridLayout (2, 1)?
I myself always do this through nested panels using BorderLayout . For instance:

JFrame frame = new JFrame("The Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panOuter = new JPanel(new BorderLayout()); JPanel panLeft = new JPanel(new BorderLayout()); panLeft.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panRight = new JPanel(new BorderLayout()); panRight.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panOuter.add(panLeft, BorderLayout.WEST); panOuter.add(panRight, BorderLayout.EAST); JLabel lblLeft = new JLabel("Label 1", JLabel.CENTER); JLabel lblRight = new JLabel("Label 2", JLabel.CENTER); JTextField txtLeft = new JTextField(10); JTextField txtLright = new JTextField(10); panLeft.add(lblLeft, BorderLayout.NORTH); panLeft.add(txtLeft, BorderLayout.CENTER); panRight.add(lblRight, BorderLayout.NORTH); panRight.add(txtLright, BorderLayout.CENTER); frame.setContentPane(panOuter); frame.pack(); frame.setVisible(true);
Note that you can manipulate the gaps between components with setting empty borders. In addition, instead of BorderLayout.WEST and BorderLayout.EAST you can use BorderLayout.LINE_START and BorderLayout.LINE_END , and this will add support for RTL languages โโ(for example, Arabic).
This leads me to the next question. What is the best way to get the same interface as above, but with a different component (button) centered under it. In fact, the user interface should be two fields with named text with a compute button at the bottom. So I did this by putting the components above in the panel, and adding that plus a calculation button to the surrounding panel with GridLayout (2, 1). The problem is that the button is getting as big as the panel above it (I guess). How can I adjust this and still adjust the button according to the text fields / shortcuts bar?
I would do it using the nested panels, as before, but now there is a FlowLayout layout manager on the bottom panel to get a good size for the button:

JFrame frame = new JFrame("The Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panOuter = new JPanel(new BorderLayout()); JPanel panLeft = new JPanel(new BorderLayout()); panLeft.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panRight = new JPanel(new BorderLayout()); panRight.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panBottom = new JPanel(); // default is FlowLayout panBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panOuter.add(panLeft, BorderLayout.WEST); panOuter.add(panRight, BorderLayout.EAST); panOuter.add(panBottom, BorderLayout.SOUTH); JLabel lblLeft = new JLabel("Label 1", JLabel.CENTER); JLabel lblRight = new JLabel("Label 2", JLabel.CENTER); JTextField txtLeft = new JTextField(10); JTextField txtLright = new JTextField(10); JButton btnBottom = new JButton("Press it!"); panLeft.add(lblLeft, BorderLayout.NORTH); panLeft.add(txtLeft, BorderLayout.CENTER); panRight.add(lblRight, BorderLayout.NORTH); panRight.add(txtLright, BorderLayout.CENTER); panBottom.add(btnBottom); frame.setContentPane(panOuter); frame.pack(); frame.setVisible(true);
Similarly over text boxes. The label should be small, but have more space for the text area.
I suggest you use a TitledBorder :

JFrame frame = new JFrame("The Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panOuter = new JPanel(new BorderLayout()); JPanel panLeft = new JPanel(new BorderLayout()); panLeft.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panRight = new JPanel(new BorderLayout()); panRight.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panBottom = new JPanel(); // default is FlowLayout panBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panInput = new JPanel(new BorderLayout()); panInput.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panConsole = new JPanel(new BorderLayout()); Border outsideBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); Border insideBorder = BorderFactory.createTitledBorder("The Console"); Border theBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder); panConsole.setBorder(theBorder); panInput.add(panLeft, BorderLayout.WEST); panInput.add(panRight, BorderLayout.EAST); panInput.add(panBottom, BorderLayout.SOUTH); panOuter.add(panInput, BorderLayout.NORTH); panOuter.add(panConsole, BorderLayout.CENTER); JLabel lblLeft = new JLabel("Label 1", JLabel.CENTER); JLabel lblRight = new JLabel("Label 2", JLabel.CENTER); JTextField txtLeft = new JTextField(10); JTextField txtLright = new JTextField(10); JButton btnBottom = new JButton("Press it!"); JTextArea txtConsole = new JTextArea(5, 10); panLeft.add(lblLeft, BorderLayout.NORTH); panLeft.add(txtLeft, BorderLayout.CENTER); panRight.add(lblRight, BorderLayout.NORTH); panRight.add(txtLright, BorderLayout.CENTER); panBottom.add(btnBottom); panConsole.add(txtConsole, BorderLayout.CENTER); frame.setContentPane(panOuter); frame.pack(); frame.setVisible(true);
third (text box): again referring to the user interface above, if the user enters many characters in the first text box, will the letters cross the text box on the right? If so, how can I prevent this?
Try the code above and see how it works :)
Fourth: if I add text to the text area and it is already full, does it automatically allow the user to scroll? If not, is this an easy way to scroll through a text area?
You need to use something called JScrollPane :

JFrame frame = new JFrame("The Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panOuter = new JPanel(new BorderLayout()); JPanel panLeft = new JPanel(new BorderLayout()); panLeft.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panRight = new JPanel(new BorderLayout()); panRight.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panBottom = new JPanel(); // default is FlowLayout panBottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panInput = new JPanel(new BorderLayout()); panInput.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panConsole = new JPanel(new BorderLayout()); Border outsideBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); Border insideBorder = BorderFactory.createTitledBorder("The Console"); Border theBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder); panConsole.setBorder(theBorder); panInput.add(panLeft, BorderLayout.WEST); panInput.add(panRight, BorderLayout.EAST); panInput.add(panBottom, BorderLayout.SOUTH); panOuter.add(panInput, BorderLayout.NORTH); panOuter.add(panConsole, BorderLayout.CENTER); JLabel lblLeft = new JLabel("Label 1", JLabel.CENTER); JLabel lblRight = new JLabel("Label 2", JLabel.CENTER); JTextField txtLeft = new JTextField(10); JTextField txtLright = new JTextField(10); JButton btnBottom = new JButton("Press it!"); JTextArea txtConsole = new JTextArea(5, 10); JScrollPane srcPane = new JScrollPane(txtConsole, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); panLeft.add(lblLeft, BorderLayout.NORTH); panLeft.add(txtLeft, BorderLayout.CENTER); panRight.add(lblRight, BorderLayout.NORTH); panRight.add(txtLright, BorderLayout.CENTER); panBottom.add(btnBottom); panConsole.add(srcPane, BorderLayout.CENTER); frame.setContentPane(panOuter); frame.pack(); frame.setVisible(true);
I hope I answered all your questions :)