private void initPainter() //определяется фигура по её id { switch (figureID) { case 0: toPaint = new GLine(); break; case 1: toPaint = new GCurve(); break; case 2: toPaint = new GRectangle(); break; case 3: toPaint = new GEllipse(); break; default: toPaint = new GLine(); break; //фигура по умолчанию - линия } //устанавливаются параметры фигуры toPaint.loadColors(primaryColor, secondaryColor, frameColor); toPaint.firstPoint = start; //точка (для рисования) начала фигуры toPaint.secondPoint = start; //точка (для рисования) конца фигуры toPaint.lineWidth = lineWidth; //толщина пера toPaint.fill = solidFill; //наличие заливки }
private void initPainter() { //set type of object to paint switch (figureID) { case 0: toPaint = new GLine(); break; case 1: toPaint = new GCurve(); break; case 2: toPaint = new GRectangle(); break; case 3: toPaint = new GEllipse(); break; default: toPaint = new GLine(); break; //if figure is unknown - set as line } //set properties of new figure toPaint.loadColors(primaryColor, secondaryColor, frameColor); toPaint.firstPoint = start; toPaint.secondPoint = start; toPaint.lineWidth = lineWidth; toPaint.fill = solidFill; }