/** * Paints a line at the current location of the divider. * @param g the Graphics used to paint */ public void paint( Graphics g ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( current != null && pressed ) { station.getPaint().drawDivider( g, bounds ); } } } }
/** * Paints a line at the current location of the divider. * @param g the Graphics used to paint */ public void paint( Graphics g ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( current != null && pressed ) { station.getPaint().drawDivider( g, bounds ); } } } }
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 public void mousePressed( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( !pressed ) { pressed = true; mouseMoved( e ); if( current != null ) { divider = current.getDividerAt( e.getX() + deltaX, e.getY() + deltaY ); divider = current.validateDivider( divider ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); bounds = current.getDividerBounds( divider, bounds ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); } } } }
@Override public void mousePressed( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( !pressed ) { pressed = true; mouseMoved( e ); if( current != null ) { divider = current.getDividerAt( e.getX() + deltaX, e.getY() + deltaY ); divider = current.validateDivider( divider ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); bounds = current.getDividerBounds( divider, bounds ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); } } } }
public void mouseDragged( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( pressed && current != null ) { divider = current.getDividerAt( e.getX() + deltaX, e.getY() + deltaY ); divider = current.validateDivider( divider ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); bounds = current.getDividerBounds( divider, bounds ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); if( station.isContinousDisplay() && current != null ) { setDivider( current, divider ); station.updateBounds(); } } } }
public void mouseDragged( MouseEvent e ){ if( station.isResizingEnabled() && !station.isDisabled() ) { if( pressed && current != null ) { divider = current.getDividerAt( e.getX() + deltaX, e.getY() + deltaY ); divider = current.validateDivider( divider ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); bounds = current.getDividerBounds( divider, bounds ); repaint( bounds.x, bounds.y, bounds.width, bounds.height ); if( station.isContinousDisplay() && current != null ) { setDivider( current, divider ); station.updateBounds(); } } } }