public void drawDashedLine(int d, int x1, int y1, int x2, int y2) { Stroke s = getStroke(); float w = 1; int c = BasicStroke.CAP_BUTT; int j = BasicStroke.JOIN_MITER; float ml = 0; float[] dp = {d, d}; if (s instanceof BasicStroke) { BasicStroke b = (BasicStroke) s; w = b.getLineWidth(); c = b.getEndCap(); j = b.getLineJoin(); ml = b.getMiterLimit(); } setStroke(new BasicStroke(w, c, j, ml, dp, 0)); drawLine(x1, y1, x2, y2); setStroke(s); }
/** [Internal] */ public String obj2str(Object o) { if (o == null) return "-null-"; String s = ""; if (o instanceof Object[]) { Object[] a = (Object[]) o; for (Object ox : a) s = s + " " + ox; } else if (o instanceof BasicStroke) { BasicStroke o1 = (BasicStroke) o; s = "BasicStroke(" + o1.getLineWidth() + "," + o1.getDashPhase() + "," + o1.getLineJoin() + "," + o1.getMiterLimit() + "," + o1.getEndCap(); } else s = "" + o; return s; }