Ok, so I’m writing a program with a GUI for the first time… but I’m kind of a perfectionist so this is bugging me:
Frame root = new JFrame();
JPanel input_screen;
JPanel wait_screen;
JPanel result_screen;
JTextArea input;
JTextArea solution_box;
JScrollPane scroll;
...
input_screen = new JPanel();
// Create the screen where they enter the puzzle
Box box = Box.createVerticalBox();
JLabel puzzleText = new JLabel("Puzzle:");
box.add(puzzleText);
input = new JTextArea(5, 5);
box.add(input);
JButton solve = new JButton("Solve");
solve.setActionCommand("submit");
box.add(solve);
solve.addActionListener(this);
input_screen.add(box);
The problem is that when I type in the JTextArea, the JLabel and JButton above and below it move with the text. How can I set them to be in fixed positions? I tried containing the JTextArea in its own JPanel… but it didn’t fix it.