Search in sources :

Example 1 with NotReadyException

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();
    }
}
Also used : NotReadyException(cbit.gui.graph.GraphModel.NotReadyException) Rectangle(java.awt.Rectangle) Dimension(java.awt.Dimension) Graphics2D(java.awt.Graphics2D)

Aggregations

NotReadyException (cbit.gui.graph.GraphModel.NotReadyException)1 Dimension (java.awt.Dimension)1 Graphics2D (java.awt.Graphics2D)1 Rectangle (java.awt.Rectangle)1