nekt / 13.01.2020

How To Draw A Thick Line In Java

setStroke(new BasicStroke(10)); (new (30, 20, 80, https:// import *; import *; public class thickLine extends Applet { public void init() { } public void paint(Graphics g) { drawThickLine (g, 0, 0.

You need to call setStroke method of Graphics2D. Check following example: Java Code: 1. 2. 3. 4. 5. 6. 7. 8. 9. This article describes how to increase the line width when drawing with a import setStroke(new BasicStroke(10)); (new Line2D. Draw a thick line: Line «SWT 2D Graphics «Java Tutorial.

Conceptually, the Stroke describes the pen or brush that is used to draw the line: it controls all line-drawing attributes, such as line width and dash pattern. Java.

Drawing Thicker Lines. There is no predefined method to draw a thicker line in Java. Drawing lines with a gap of one pixel makes a thicker line.

In this part of the Java 2D tutorial, we do some basic drawing. package com. zetcode; import . In our case a line is 8 px thick.

FILED UNDER : Tutorials