JAVA   227
FreehandLine
Guest on 9th February 2023 03:12:03 AM


  1. /**
  2.  * Write a description of class FreehandLine here.
  3.  *
  4.  * @author (your name)
  5.  * @version (a version number or a date)
  6.  */
  7. import objectdraw.*;
  8. public class FreehandLine
  9. {
  10.  
  11.     private static final int MAXSEGMENTS = 1000;
  12.     private Line[] segments = new Line[MAXSEGMENTS];
  13.     private int numSegments = 0;
  14.     /**
  15.      * Constructor for objects of class FreehandLine
  16.      */
  17.     public FreehandLine()
  18.     {
  19.        
  20.     }
  21.    
  22.     public void addSegment(Line someLine) {
  23.         if (numSegments < MAXSEGMENTS) {
  24.             segments[numSegments] = someLine;
  25.             numSegments++;
  26.            
  27.         }        
  28.     }
  29.    
  30.     public void hide() {
  31.         for (int i = 0; i < numSegments; i++) {
  32.             segments[i].hide();
  33.            
  34.         }
  35.        
  36.     }
  37.  
  38.  
  39. }

Raw Paste

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