Итак, я настроил большинство своих компонентов так, как хочу, но по какой-то причине мой JTable показывает только половину своего тела на краю панели. Кажется, это делается всякий раз, когда я хочу добавить JScrollPane в JTable.
Как выглядит графический интерфейс при запуске программы
JPanel billPanel = new JPanel();
JPanel fieldsPanel = new JPanel();
JPanel overhead = new JPanel();
JPanel buttonPanel = new JPanel();
JComboBox choosePerson = new JComboBox();
JTextField billName = new JTextField();
JTextField billComment = new JTextField();
JTextField billAmount = new JTextField();
JTable billTable = new JTable();
JButton removeBillButton = new JButton("Ta bort räkning");
JButton addBillButton = new JButton("Lägg till person");
JButton clearButton = new JButton("Rensa");
JScrollPane scroll = new JScrollPane(billTable);
JLabel title = new JLabel("Personer");
public BillPage() {
fieldsPanel.setLayout(new BoxLayout(fieldsPanel, BoxLayout.Y_AXIS));
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
overhead.setLayout(new BorderLayout());
billPanel.setLayout(new BorderLayout());
billPanel.add(overhead, BorderLayout.NORTH);
billPanel.add(fieldsPanel, BorderLayout.CENTER);
billPanel.add(buttonPanel, BorderLayout.EAST);
overheadPanel.setPreferredSize(new Dimension(600, 100));
overheadPanel.add(title, BorderLayout.WEST);
fieldsPanel.add(billName);
fieldsPanel.add(Box.createRigidArea(new Dimension(0, 30)));
fieldsPanel.add(billComment);
fieldsPanel.add(Box.createRigidArea(new Dimension(0, 30)));
fieldsPanel.add(billAmount);
fieldsPanel.add(Box.createRigidArea(new Dimension(0, 30)));
fieldsPanel.add(choosePerson);
fieldsPanel.add(Box.createRigidArea(new Dimension(0, 30)));
fieldsPanel.add(scroll);
fieldsPanel.setBorder(new EmptyBorder(0,0,0,100));
buttonPanel.add(addBillButton);
buttonPanel.add(Box.createRigidArea(new Dimension(0, 50)));
buttonPanel.add(clearButton);
buttonPanel.add(Box.createRigidArea(new Dimension(0, 300)));
buttonPanel.add(removeBillButton);
billName.setPreferredSize(new Dimension(200,30));
billComment.setPreferredSize(new Dimension(200,30));
billAmount.setPreferredSize(new Dimension(200,30));
removeBillButton.setPreferredSize(new Dimension(150,100));
}