| | | | Browse by category |
Question
How to restrict panning to the boundaries of my Network or Equipment component?
Answer
JTGO uses IlvPanInteractor to pan the view. To prevent the mouse dragging from going outside the boundaries of the container, you can override the method IlvPanInteractor.processMouseMotionEvent. For example:
class MyPanInteractor extends ilog.views.interactor.IlvPanInteractor
{
protected void processMouseMotionEvent(java.awt.event.MouseEvent e) {
int dx = 0;
int dy = 0;
if (e.getX() >= 0)
dx = Math.min(0, getManagerView().getWidth() - e.getX());
else
dx = -e.getX();
if (e.getY() >= 0)
dy = Math.min(0, getManagerView().getHeight() - e.getY());
else
dy = -e.getY();
e.translatePoint(dx, dy);
super.processMouseMotionEvent(e);
}
}
For more information on how to customize the buttons on the toolbar, see the following resources in the "How to..." section of the User's Documentation:
How to Add a Custom Toolbar Button
How to Add a Predefined Toolbar Button