setPageIndex(anchorIndex.getPageIndex());
refreshPage();
}
Container container = pnlInScroll.getParent();
if (container instanceof JViewport) {
JViewport viewport = (JViewport) container;
int newX = (int) (anchorIndex.getElement().getX() * realZoom);
int newY = (int) (anchorIndex.getElement().getY() * realZoom);
int maxX = pnlInScroll.getWidth() - viewport.getWidth();
int maxY = pnlInScroll.getHeight() - viewport.getHeight();
if (newX < 0) {
newX = 0;
}
if (newX > maxX) {
newX = maxX;
}
if (newY < 0) {
newY = 0;
}
if (newY > maxY) {
newY = maxY;
}
viewport.setViewPosition(new Point(newX, newY));
}
}
break;
case JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE:
int page = pageIndex + 1;
if (hyperlink.getHyperlinkPage() != null) {
page = hyperlink.getHyperlinkPage().intValue();
}
if (page >= 1 && page <= jasperPrint.getPages().size()
&& page != pageIndex + 1) {
setPageIndex(page - 1);
refreshPage();
Container container = pnlInScroll.getParent();
if (container instanceof JViewport) {
JViewport viewport = (JViewport) container;
viewport.setViewPosition(new Point(0, 0));
}
}
break;