public static <NodeType extends ZyGraphNode<?>> void zoomToNode(
      final AbstractZyGraph<NodeType, ?> graph,
      final NodeType node,
      final int line,
      final boolean animate) {
    Preconditions.checkNotNull(node, "Error: Node argument can't be null");

    final IZyNodeRealizer realizer = node.getRealizer();

    Preconditions.checkNotNull(realizer, "Error: Node does not belong to the graph");

    final double offset = realizer.getNodeContent().getLineHeight() * line;

    final Point2D oldViewPoint = graph.getView().getViewPoint2D();

    graph
        .getView()
        .setCenter(
            realizer.getCenterX(), (realizer.getCenterY() - (realizer.getHeight() / 2)) + offset);

    if (animate) {
      final Point2D newCenter = graph.getView().getCenter();

      graph.getView().setViewPoint((int) oldViewPoint.getX(), (int) oldViewPoint.getY());
      graph
          .getView()
          .focusView(
              graph.getView().getZoom(),
              newCenter,
              graph.getSettings().getLayoutSettings().getAnimateLayout());
    }

    graph.updateViews();
  }
Zooms to a single node.

@param node The node in question.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/functions/ZoomFunctions.java