@Override protected void deviceDrawLine(int xBegin,int yBegin,int xEnd,int yEnd,Color color){
  Stroke stroke=getStroke();
  if (stroke instanceof BasicStroke) {
    BasicStroke lineStroke=(BasicStroke)stroke;
    if (lineStroke.getDashArray() != null) {
      draw(new Line2D.Float(xBegin,yBegin,xEnd,yEnd));
      return;
    }
    float lineWidth=lineStroke.getLineWidth();
    Point2D.Float penSize=new Point2D.Float(lineWidth,lineWidth);
    AffineTransform deviceTransform=getTransform();
    deviceTransform.deltaTransform(penSize,penSize);
    float deviceLineWidth=Math.min(Math.abs(penSize.x),Math.abs(penSize.y));
    Point2D.Float begin_pos=new Point2D.Float(xBegin,yBegin);
    deviceTransform.transform(begin_pos,begin_pos);
    Point2D.Float end_pos=new Point2D.Float(xEnd,yEnd);
    deviceTransform.transform(end_pos,end_pos);
    int endCap=lineStroke.getEndCap();
    int lineJoin=lineStroke.getLineJoin();
    if ((end_pos.getX() == begin_pos.getX()) && (end_pos.getY() == begin_pos.getY())) {
      endCap=BasicStroke.CAP_ROUND;
    }
    WPrinterJob wPrinterJob=(WPrinterJob)getPrinterJob();
    if (wPrinterJob.selectStylePen(endCap,lineJoin,deviceLineWidth,color)) {
      wPrinterJob.moveTo((float)begin_pos.getX(),(float)begin_pos.getY());
      wPrinterJob.lineTo((float)end_pos.getX(),(float)end_pos.getY());
    }
 else {
      double lowerRes=Math.min(wPrinterJob.getXRes(),wPrinterJob.getYRes());
      if ((endCap == BasicStroke.CAP_ROUND) || (((xBegin == xEnd) || (yBegin == yEnd)) && (deviceLineWidth / lowerRes < MAX_THINLINE_INCHES))) {
        wPrinterJob.selectPen(deviceLineWidth,color);
        wPrinterJob.moveTo((float)begin_pos.getX(),(float)begin_pos.getY());
        wPrinterJob.lineTo((float)end_pos.getX(),(float)end_pos.getY());
      }
 else {
        draw(new Line2D.Float(xBegin,yBegin,xEnd,yEnd));
      }
    }
  }
}

@ Override protected void deviceDrawLine ( int xBegin , int yBegin , int xEnd , int yEnd , Color color ) { Stroke stroke = getStroke ( ) ; if ( stroke instanceof BasicStroke ) { BasicStroke lineStroke = ( BasicStroke ) stroke ; if ( lineStroke . getDashArray ( ) != null ) { draw ( new Line2D . Float ( xBegin , yBegin , xEnd , yEnd ) ) ; return ; } float lineWidth = lineStroke . getLineWidth ( ) ; Point2D . Float penSize = new Point2D . Float ( lineWidth , lineWidth ) ; AffineTransform deviceTransform = getTransform ( ) ; deviceTransform . deltaTransform ( penSize , penSize ) ; float deviceLineWidth = Math . min ( Math . abs ( penSize . x ) , Math . abs ( penSize . y ) ) ; Point2D . Float begin_pos = new Point2D . Float ( xBegin , yBegin ) ; deviceTransform . transform ( begin_pos , begin_pos ) ; Point2D . Float end_pos = new Point2D . Float ( xEnd , yEnd ) ; deviceTransform . transform ( end_pos , end_pos ) ; int endCap = lineStroke . getEndCap ( ) ; int lineJoin = lineStroke . getLineJoin ( ) ; if ( ( end_pos . getX ( ) == begin_pos . getX ( ) ) && ( end_pos . getY ( ) == begin_pos . getY ( ) ) ) { endCap = BasicStroke . CAP_ROUND ; } WPrinterJob wPrinterJob = ( WPrinterJob ) getPrinterJob ( ) ; if ( wPrinterJob . selectStylePen ( endCap , lineJoin , deviceLineWidth , color ) ) { wPrinterJob . moveTo ( ( float ) begin_pos . getX ( ) , ( float ) begin_pos . getY ( ) ) ; wPrinterJob . lineTo ( ( float ) end_pos . getX ( ) , ( float ) end_pos . getY ( ) ) ; } else { double lowerRes = Math . min ( wPrinterJob . getXRes ( ) , wPrinterJob . getYRes ( ) ) ; if ( ( endCap == BasicStroke . CAP_ROUND ) || ( ( ( xBegin == xEnd ) || ( yBegin == yEnd ) ) && ( deviceLineWidth / lowerRes < MAX_THINLINE_INCHES ) ) ) { wPrinterJob . selectPen ( deviceLineWidth , color ) ; wPrinterJob . moveTo ( ( float ) begin_pos . getX ( ) , ( float ) begin_pos . getY ( ) ) ; wPrinterJob . lineTo ( ( float ) end_pos . getX ( ) , ( float ) end_pos . getY ( ) ) ; } else { draw ( new Line2D . Float ( xBegin , yBegin , xEnd , yEnd ) ) ; } } } }
draw a line using a pen created using the specified color and current stroke properties .
