/** * If dragger is not null it is messaged with continueDrag. */ @Override public void mouseDragged(MouseEvent e) { if (_dragger != null) { if (e.getSource() == _jideSplitPane) { _dragger.continueDrag(e.getX(), e.getY()); } else if (e.getSource() == JideSplitPaneDivider.this) { Point ourLoc = getLocation(); _dragger.continueDrag(e.getX() + ourLoc.x, e.getY() + ourLoc.y); } e.consume(); } } }
/** * If dragger is not null it is messaged with completeDrag. */ @Override public void mouseReleased(MouseEvent e) { if (_dragger != null) { if (e.getSource() == _jideSplitPane) { _dragger.completeDrag(e.getX(), e.getY()); } else if (e.getSource() == JideSplitPaneDivider.this) { Point ourLoc = getLocation(); _dragger.completeDrag(e.getX() + ourLoc.x, e.getY() + ourLoc.y); } _dragger = null; e.consume(); } }
/** * Returns the new position to put the divider at based on the passed in MouseEvent. * * @param e the mouse event. * @return the position of the mouse event after considering the max and min size it is allowed. */ protected int positionForMouseEvent(MouseEvent e) { int newX = (e.getSource() == JideSplitPaneDivider.this) ? (e.getX() + getLocation().x) : e.getX(); newX = Math.min(maxLocation, Math.max(minLocation, newX - offset)); if (_jideSplitPane.getDividerStepSize() != 0) { int distanceFromCurrent = newX - getX(); newX -= (distanceFromCurrent % _jideSplitPane.getDividerStepSize()); } return newX; }
/** * Returns the new position to put the divider at based on the passed in MouseEvent. */ @Override protected int positionForMouseEvent(MouseEvent e) { int newY = (e.getSource() == JideSplitPaneDivider.this) ? (e.getY() + getLocation().y) : e.getY(); newY = Math.min(maxLocation, Math.max(minLocation, newY - offset)); if (_jideSplitPane.getDividerStepSize() != 0) { int distanceFromCurrent = newY - getY(); newY -= (distanceFromCurrent % _jideSplitPane.getDividerStepSize()); } return newY; } } // End of BasicSplitPaneDividier.VerticalDragController
Component rightC = getSecondComponent(false); initialLocation = getLocation().y; if (e.getSource() == JideSplitPaneDivider.this) { offset = e.getY();
Component rightC = reversed ? getFirstComponent(false) : getSecondComponent(false); initialLocation = getLocation().x; if (e.getSource() == JideSplitPaneDivider.this) { offset = e.getX();