src/main/java/com/mxgraph/swing/mxGraphComponent.java
public void scrollCellToVisible(Object cell, boolean center)
	{
		mxCellState state = graph.getView().getState(cell);

		if (state != null)
		{
			mxRectangle bounds = state;

			if (center)
			{
				bounds = (mxRectangle) bounds.clone();

				bounds.setX(bounds.getCenterX() - getWidth() / 2);
				bounds.setWidth(getWidth());
				bounds.setY(bounds.getCenterY() - getHeight() / 2);
				bounds.setHeight(getHeight());
			}

			getGraphControl().scrollRectToVisible(bounds.getRectangle());
		}
	}
/**
	 * Scrolls the graph so that it shows the given cell.
	 * 
	 * @param cell
	 */
Scrolls the graph so that it shows the given cell.

@param cell
Scrolls the graph so that it shows the given cell . @param cell
public void scrollCellToVisible(Object cell, boolean center)
	{
		mxCellState state = graph.getView().getState(cell);
		if (state != null)
		{
			mxRectangle bounds = state;
			if (center)
			{
				bounds = (mxRectangle) bounds.clone();
				bounds.setX(bounds.getCenterX() - getWidth() / 2);
				bounds.setWidth(getWidth());
				bounds.setY(bounds.getCenterY() - getHeight() / 2);
				bounds.setHeight(getHeight());
			}
			getGraphControl().scrollRectToVisible(bounds.getRectangle());
		}
	}
public void scrollCellToVisible ( Object cell , boolean center ) { mxCellState state = graph . getView ( ) . getState ( cell ) ; if ( state != null ) { mxRectangle bounds = state ; if ( center ) { bounds = ( mxRectangle ) bounds . clone ( ) ; bounds . setX ( bounds . getCenterX ( ) - getWidth ( ) / 2 ) ; bounds . setWidth ( getWidth ( ) ) ; bounds . setY ( bounds . getCenterY ( ) - getHeight ( ) / 2 ) ; bounds . setHeight ( getHeight ( ) ) ; } getGraphControl ( ) . scrollRectToVisible ( bounds . getRectangle ( ) ) ; } }
Scrolls the graph so that it shows the given cell.
Scrolls the graph so that it shows the given cell .