Here you can find the source of drawDottedDashLine(Graphics2D g, int x1, int y1, int x2, int y2)
public static void drawDottedDashLine(Graphics2D g, int x1, int y1, int x2, int y2)
//package com.java2s; /*/* www . java 2 s . c o m*/ * Copyright (c) 2007-2012 The Broad Institute, Inc. * SOFTWARE COPYRIGHT NOTICE * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved. * * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality. * * This software is licensed under the terms of the GNU Lesser General Public License (LGPL), * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php. */ import java.awt.*; public class Main { public static void drawDottedDashLine(Graphics2D g, int x1, int y1, int x2, int y2) { Stroke thindashed = new BasicStroke(1.0f, // line width BasicStroke.CAP_BUTT, // cap style BasicStroke.JOIN_BEVEL, 1.0f, // join style, miter limit new float[] { 8.0f, 3.0f, 2.0f, 3.0f }, // the dash pattern : on 8, off 3, on 2, off 3 0.0f); // the dash phase drawDashedLine(g, thindashed, x1, y1, x2, y2); } public static void drawDashedLine(Graphics2D g, int x1, int y1, int x2, int y2) { Stroke thindashed = new BasicStroke(1.0f, // line width BasicStroke.CAP_BUTT, // cap style BasicStroke.JOIN_BEVEL, 1.0f, // join style, miter limit new float[] { 3.0f, 3.0f }, // the dash pattern : on 8, off 3, on 2, off 3 0.0f); // the dash phase drawDashedLine(g, thindashed, x1, y1, x2, y2); } /** * Method description * Stroke thindashed = new BasicStroke(thickness, // line width * BasicStroke.CAP_BUTT, // cap style * BasicStroke.JOIN_BEVEL, 1.0f, // join style, miter limit * dashPattern, // the dash pattern : on 8, off 3, on 2, off 3 * phase); // the dash phase * * @param g */ public static void drawDashedLine(Graphics2D g, Stroke stroke, int x1, int y1, int x2, int y2) { Stroke currentStroke = g.getStroke(); g.setStroke(stroke); g.drawLine(x1, y1, x2, y2); g.setStroke(currentStroke); } }