I figured it out! The problem is with the parameter on the JEditorPane:
panel.add(new JEditorPane(), "growx, pushx, span");
It turns out that when using span
, growx, pushx
is unnecessary (because it already grows in size) and when used in conjunction with this, it creates the effect shown above. My guess is that growx
applies to all cells marked by span
, but pushx
only applies to the first cell.
So span
makes the component take up multiple cells, they all were assigned the default growx
weight, but pushx
only makes the first cell grow.
So the proper way to fix the line is simply:
panel.add(new JEditorPane(), "span");