The problem you are observing is GridBagLayout trying to cope with a situation where it is unable to execute the preferredSize component, it returns instead of using the minimumSize components ...
You can use the GridBagConstraints#weightx property to force the component to always fill the column width ...
c = new GridBagConstraints(); c.gridx = 1; c.gridy = 0; c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; c.weightx = 1.0; contentPanel.add(shortText, c); c = new GridBagConstraints(); c.gridx = 1; c.gridy = 1; c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; c.weightx = 1.0; contentPanel.add(messageText, c);
This will not stop it from being compressed, but it will stop it from “snapping” from one size to another.
Try and don’t use setPreferredSize , check Should I avoid using the methods of the Set method (Preferred | Maximum | Minimum) in Java Swing? for more information, use the rows and columns JTextArea ...
shortText.setRows(2); // for example
Personally, I would also JTextArea in a JScrollPane , then it becomes, a little, less important to have enough space for each
Feedback...
Now the question is out of context, but it seems to me that you will put a lot of effort into a small gain.
For example, you can use JOptionPane instead and take advantage of the Swing HTML rendering capabilities ...

import java.awt.EventQueue; import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class OptionPaneTest { public static void main(String[] args) { new OptionPaneTest(); } public OptionPaneTest() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } StringBuilder sb = new StringBuilder(128); sb.append("<html><b><p align=center>You won't get away with this!</p></b><br>"); sb.append("Alert! Alert! A chocy nut bar has been removed without payment!"); sb.append("<br>A chocy nut bar... has been REMOVED! WITHOUT PAYMENT! Alert, alert!"); JOptionPane.showMessageDialog(null, sb.toString(), "Alert", JOptionPane.WARNING_MESSAGE); } }); } }
Also...
I think you will find ...
frame.setLocationRelativeTo(null);
Much easier and less time ...
frame.setLocation(SCREENCENTER.x - frame.getSize().width / 2, SCREENCENTER.y - frame.getSize().height / 2);
It also means that you can use t.setLocationRelativeTo(frame) as well ...
Oh, also +1 for a link with a red dwarf;)
Updated from updates to the question
The solution remains (basically) the same, use JTextArea#setRows and JTextArea#setColumns ...
Your code ...

My code ...

JTextArea shortText = makeMultiLineLabel(true); shortText.setBorder(BorderFactory.createEtchedBorder()); shortText.setFont(shortText.getFont().deriveFont(Font.BOLD)); // FontMetrics fm = shortText.getFontMetrics( // shortText.getFont()); // shortText.setPreferredSize(new Dimension( // Math.min(fm.stringWidth(shortMessage), 300), // fm.getHeight())); shortText.setRows(2); shortText.setColumns(20); shortText.setText(shortMessage); JTextArea messageText = makeMultiLineLabel(true); messageText.setBorder(BorderFactory.createEtchedBorder()); messageText.setFont(shortText.getFont().deriveFont(Font.PLAIN)); // fm = messageText.getFontMetrics( // messageText.getFont()); // messageText.setPreferredSize(new Dimension( // Math.min(fm.stringWidth(message), 300), // fm.getHeight())); messageText.setRows(4); messageText.setColumns(20); messageText.setText(message);
You can also watch SwingX JXErrorDialog as well