private GridBagLayout layout; // ... public ChatClient() { /* GUI section */ super("Chat Client"); setLayout(layout); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.gridwidth = 6; c.gridheight = 10; c.weighty = 0.9; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.FIRST_LINE_START; add(new JScrollPane(msgBox), c); c.gridx = 0; c.gridy = 10; c.gridwidth = 5; c.gridheight = 2; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LAST_LINE_START; add(entryBar, c); c.gridx = 5; c.gridy = 1; c.gridwidth = 1; c.gridheight = 2; c.weightx = 0.16; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LAST_LINE_END; add(sendButton, c); //... msgBox.setEditable(false); // (this is the messages received pane) pack(); setVisible(true); /* end GUI section */ //... }