Java - JPanel with a painted square doesn't display correctly

Printable View