JAVA   37
RubberBand
Guest on 9th February 2023 03:06:24 AM


  1. import objectdraw.*;
  2.  
  3. public class RubberBand extends WindowController {
  4.        
  5.         private Line currentLine;
  6.         private Location start;
  7.        
  8.         public void onMousePress( Location point )
  9.         {
  10.                 start = point;
  11.                 currentLine = new Line( point, point, canvas);
  12.         }
  13.  
  14.         public void onMouseDrag( Location point )
  15.         {
  16.                 currentLine.removeFromCanvas();
  17.                 currentLine = new Line( start, point, canvas);
  18.                
  19.         }
  20. }

Raw Paste

Login or Register to edit or fork this paste. It's free.