Пример #1
0
 /**
  * Set the radius of the pen to the given size.
  *
  * @param r the radius of the pen
  * @throws RuntimeException if r is negative
  */
 public static void setPenRadius(double r) {
   if (r < 0) throw new RuntimeException("pen radius must be positive");
   penRadius = r * DEFAULT_SIZE;
   BasicStroke stroke =
       new BasicStroke((float) penRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
   // BasicStroke stroke = new BasicStroke((float) penRadius);
   offscreen.setStroke(stroke);
 }
Пример #2
0
 /**
  * Set the radius of the pen to the given size.
  *
  * @param r the radius of the pen
  * @throws IllegalArgumentException if r is negative
  */
 public static void setPenRadius(double r) {
   if (r < 0) throw new IllegalArgumentException("pen radius must be nonnegative");
   penRadius = r;
   float scaledPenRadius = (float) (r * DEFAULT_SIZE);
   BasicStroke stroke =
       new BasicStroke(scaledPenRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
   // BasicStroke stroke = new BasicStroke(scaledPenRadius);
   offscreen.setStroke(stroke);
 }
Пример #3
0
 private void setPenWidth(int width) {
   gRef.setStroke(new BasicStroke(width));
 }