src/main/java/com/mxgraph/swing/mxGraphComponent.java
public void updatePreferredSize()
		{
			double scale = graph.getView().getScale();
			Dimension d = null;

			if (preferPageSize || pageVisible)
			{
				Dimension page = getPreferredSizeForPage();

				if (!preferPageSize)
				{
					page.width += 2 * getHorizontalPageBorder();
					page.height += 2 * getVerticalPageBorder();
				}

				d = new Dimension((int) (page.width * scale),
						(int) (page.height * scale));
			}
			else
			{
				d = getScaledPreferredSizeForGraph();
			}

			mxRectangle min = graph.getMinimumGraphSize();

			if (min != null)
			{
				d.width = (int) Math.max(d.width,
						Math.round(min.getWidth() * scale));
				d.height = (int) Math.max(d.height,
						Math.round(min.getHeight() * scale));
			}

			if (!getPreferredSize().equals(d))
			{
				setPreferredSize(d);
				setMinimumSize(d);
				revalidate();
			}
		}
/**
		 * Updates the preferred size for the given scale if the page size
		 * should be preferred or the page is visible.
		 */
Updates the preferred size for the given scale if the page size
should be preferred or the page is visible.
Updates the preferred size for the given scale if the page size should be preferred or the page is visible .
public void updatePreferredSize()
		{
			double scale = graph.getView().getScale();
			Dimension d = null;
			if (preferPageSize || pageVisible)
			{
				Dimension page = getPreferredSizeForPage();
				if (!preferPageSize)
				{
					page.width += 2 * getHorizontalPageBorder();
					page.height += 2 * getVerticalPageBorder();
				}
				d = new Dimension((int) (page.width * scale),
						(int) (page.height * scale));
			}
			else
			{
				d = getScaledPreferredSizeForGraph();
			}
			mxRectangle min = graph.getMinimumGraphSize();
			if (min != null)
			{
				d.width = (int) Math.max(d.width,
						Math.round(min.getWidth() * scale));
				d.height = (int) Math.max(d.height,
						Math.round(min.getHeight() * scale));
			}
			if (!getPreferredSize().equals(d))
			{
				setPreferredSize(d);
				setMinimumSize(d);
				revalidate();
			}
		}
public void updatePreferredSize ( ) { double scale = graph . getView ( ) . getScale ( ) ; Dimension d = null ; if ( preferPageSize || pageVisible ) { Dimension page = getPreferredSizeForPage ( ) ; if ( ! preferPageSize ) { page . width += 2 * getHorizontalPageBorder ( ) ; page . height += 2 * getVerticalPageBorder ( ) ; } d = new Dimension ( ( int ) ( page . width * scale ) , ( int ) ( page . height * scale ) ) ; } else { d = getScaledPreferredSizeForGraph ( ) ; } mxRectangle min = graph . getMinimumGraphSize ( ) ; if ( min != null ) { d . width = ( int ) Math . max ( d . width , Math . round ( min . getWidth ( ) * scale ) ) ; d . height = ( int ) Math . max ( d . height , Math . round ( min . getHeight ( ) * scale ) ) ; } if ( ! getPreferredSize ( ) . equals ( d ) ) { setPreferredSize ( d ) ; setMinimumSize ( d ) ; revalidate ( ) ; } }
Updates the preferred size for the given scale if the page size
 should be preferred or the page is visible.
Updates the preferred size for the given scale if the page size should be preferred or the page is visible .