public void paintSelection(Graphics g0){
  if (selectedBlock.isSelected()) {
    Graphics2D g=(Graphics2D)g0;
    double xMin=Math.min(getX(selectedBlock.getFirstCol()),getSize().width);
    double xMax=Math.min((getX(selectedBlock.getLastCol() + 1)),getSize().width - 2);
    double yMin=Math.min(getY(selectedBlock.getFirstRow() - 1),getSize().height - 3);
    double yMax=Math.min(getY(selectedBlock.getLastRow()),getSize().height - 3);
    Rectangle2D rect=new Rectangle2D.Double(xMin,yMin,0,0);
    rect.add(xMax,yMax);
    g.setColor(highlightColor);
    g.draw(rect);
    g.setColor(highlightColorSemiTransparent);
    g.fill(rect);
    selectionRectangle.setRectangle(this,rect);
  }
  selectionRectangle.setAnimate(selectedBlock.isSelected());
}

public void paintSelection ( Graphics g0 ) { if ( selectedBlock . isSelected ( ) ) { Graphics2D g = ( Graphics2D ) g0 ; double xMin = Math . min ( getX ( selectedBlock . getFirstCol ( ) ) , getSize ( ) . width ) ; double xMax = Math . min ( ( getX ( selectedBlock . getLastCol ( ) + 1 ) ) , getSize ( ) . width - 2 ) ; double yMin = Math . min ( getY ( selectedBlock . getFirstRow ( ) - 1 ) , getSize ( ) . height - 3 ) ; double yMax = Math . min ( getY ( selectedBlock . getLastRow ( ) ) , getSize ( ) . height - 3 ) ; Rectangle2D rect = new Rectangle2D . Double ( xMin , yMin , 0 , 0 ) ; rect . add ( xMax , yMax ) ; g . setColor ( highlightColor ) ; g . draw ( rect ) ; g . setColor ( highlightColorSemiTransparent ) ; g . fill ( rect ) ; selectionRectangle . setRectangle ( this , rect ) ; } selectionRectangle . setAnimate ( selectedBlock . isSelected ( ) ) ; }
paint the selection rectangle
