if (!slopeDisplay.getText().isEmpty() && locationDisplay.getPreferredSize().width + slopeDisplay.getPreferredSize().width > contentWidth) {
locationDisplay.setPreferredSize(new Dimension (1,locationDisplay.getPreferredSize().height));
}
/* Finally, request that these new preferred sizes get enforced */
plot.revalidate();
}
/**
* Prevent JLabels from shrinking when empty, but size freely when filled
* (originally from PlotDataCursor)