use of cbit.gui.graph.GraphModel.NotReadyException in project vcell by virtualcell.
the class GraphPane method getPreferredSize.
@Override
public Dimension getPreferredSize() {
if (graphModel != null) {
Dimension prefSize;
try {
prefSize = graphModel.getPreferedCanvasSize((Graphics2D) getGraphics());
} catch (NotReadyException e) {
return super.getPreferredSize();
}
if (getJScrollPaneParent() != null) {
Rectangle viewBorderBounds = getJScrollPaneParent().getViewportBorderBounds();
prefSize = new Dimension(Math.max(viewBorderBounds.width, prefSize.width), Math.max(viewBorderBounds.height, prefSize.height));
}
return prefSize;
} else {
return super.getPreferredSize();
}
}
Aggregations