public void mouseMoved( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { current = getDividerNode( e.getX(), e.getY() ); if( current == null ) setCursor( null ); else if( current.getOrientation() == Orientation.HORIZONTAL ) setCursor( Cursor.getPredefinedCursor( Cursor.W_RESIZE_CURSOR ) ); else setCursor( Cursor.getPredefinedCursor( Cursor.N_RESIZE_CURSOR ) ); if( current != null ) { bounds = current.getDividerBounds( current.getActualDivider(), bounds ); deltaX = bounds.width / 2 + bounds.x - e.getX(); deltaY = bounds.height / 2 + bounds.y - e.getY(); // mouse is over divider withinBounds = true; } else { // mouse is not over divider anymore withinBounds = false; } } }
public void mouseMoved( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { current = getDividerNode( e.getX(), e.getY() ); if( current == null ) setCursor( null ); else if( current.getOrientation() == Orientation.HORIZONTAL ) setCursor( Cursor.getPredefinedCursor( Cursor.W_RESIZE_CURSOR ) ); else setCursor( Cursor.getPredefinedCursor( Cursor.N_RESIZE_CURSOR ) ); if( current != null ) { bounds = current.getDividerBounds( current.getActualDivider(), bounds ); deltaX = bounds.width / 2 + bounds.x - e.getX(); deltaY = bounds.height / 2 + bounds.y - e.getY(); // mouse is over divider withinBounds = true; } else { // mouse is not over divider anymore withinBounds = false; } } }
@Override protected Divideable getDividerNode( int x, int y ){ Divideable node = super.getDividerNode( x, y ); if( node == null ){ int gap = getDividerSize(); if( side == Side.RIGHT && x <= gap ){ return new ColumnDividier( WizardSplitDockStation.this ); } else if( side == Side.LEFT && x >= getWidth() - gap - 1 ){ return new ColumnDividier( WizardSplitDockStation.this ); } else if( side == Side.TOP && y >= getHeight() - gap - 1 ){ return new ColumnDividier( WizardSplitDockStation.this ); } else if( side == Side.BOTTOM && y <= gap ){ return new ColumnDividier( WizardSplitDockStation.this ); } Leaf leaf = resizeableLeafAt( x, y ); if( leaf != null ){ return new CellDivider( WizardSplitDockStation.this, leaf ); } } return node; } }
public void run(){ if( container != null ){ PointerInfo p = MouseInfo.getPointerInfo(); Point e = p.getLocation(); SwingUtilities.convertPointFromScreen(e, container); current = getDividerNode( e.x, e.y ); if( current == null ) { mouseExited( null ); } else { // check bounds with one pixel delta -> divider needs to be greater than 2 pixels, because divider bounds will be shrinked by 1 pixel at each side if( bounds.width > 2 && bounds.height > 2 ){ if( e.x <= bounds.x || e.x >= bounds.x+bounds.width-1 || e.y <= bounds.y || e.y >= bounds.y+bounds.height-1 ){ // mouse is likely to be not on divider anymore mouseExited( null ); } } } } } });
public void run(){ if( container != null ){ PointerInfo p = MouseInfo.getPointerInfo(); Point e = p.getLocation(); SwingUtilities.convertPointFromScreen(e, container); current = getDividerNode( e.x, e.y ); if( current == null ) { mouseExited( null ); } else { // check bounds with one pixel delta -> divider needs to be greater than 2 pixels, because divider bounds will be shrinked by 1 pixel at each side if( bounds.width > 2 && bounds.height > 2 ){ if( e.x <= bounds.x || e.x >= bounds.x+bounds.width-1 || e.y <= bounds.y || e.y >= bounds.y+bounds.height-1 ){ // mouse is likely to be not on divider anymore mouseExited( null ); } } } } } });