 <p>I realized it was as simple as using setMaximumSize().</p> <p><a href="https://docs.oracle.com/javase/tutorial/uiswing/layout/box.html#size" rel="nofollow">https://docs.oracle.com/javase/tutorial/uiswing/layout/box.html#size</a> - got it from here.</p>