I have this issue with my program that I can't seem to figure out why its happening. What should happen is that when you enter in something in the input area below, it should take that and put it where the black line is which is actually a textarea box. Normally it works except that when I have both editable set to false and line wrap set the true this happens and the size should stretch across the whole panel up to the image. I've put down below the relevant code. I have been racked my brain for hours and need a new perspective.
private JTextArea message = new JTextArea(5,20);
private JLabel date = new JLabel();
private ImageIcon img = new ImageIcon(getClass().getResource("/assignment1/img/silhouette.png"));
private JLabel ImageLabel = new JLabel();
public MessagePanel(String pmessage, Date timestamp) {
this.setLayout(new GridBagLayout());
this.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
this.setPreferredSize(new Dimension(550,150));
ImageLabel.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
message.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
ImageLabel.setIcon(img);
message.setEditable(false);
message.append(pmessage);
message.setLineWrap(true);
message.setWrapStyleWord(true);
message.setCaretPosition(message.getDocument().getLength());
//message.setText(pmessage);
message.setPreferredSize(new Dimension(400,100));
SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy hh:mm a");
date.setText(f.format(timestamp));
GridBagConstraints messageConst = new GridBagConstraints();
messageConst.gridx = 0;
messageConst.gridy = 0;
messageConst.fill = GridBagConstraints.HORIZONTAL;
//messageConst.anchor = java.awt.GridBagConstraints.NORTHWEST;
messageConst.insets = new Insets(12, 83, 0, 0);
GridBagConstraints iconConst = new GridBagConstraints();
iconConst.gridx = 1;
iconConst.gridy = 0;
iconConst.anchor = java.awt.GridBagConstraints.NORTHWEST;
iconConst.insets = new Insets(49, 425, 0, 11);
GridBagConstraints dateConst = new GridBagConstraints();
dateConst.gridx = 0;
dateConst.gridy = 1;
dateConst.gridwidth = 2;
dateConst.ipadx = 70;
dateConst.anchor = GridBagConstraints.NORTHWEST;
dateConst.insets = new Insets(6, 460,0, 11);
this.add(message,messageConst);
this.add(date,dateConst);
this.add(ImageLabel,iconConst);
}