java - Java2D: Increase the line width -


I want to increase line2D width I have not found any way to do this. Do I really need to make a small rectangle for this purpose?

You set setStroke to graphics 2D object To set the stroke of

In the example you give some code examples.

The following code creates the following image:

import java.awt. *; Import java.awt.geom.Line2D; Import javax.swing *; Public Class Framework {Public Stable Zero Main (String [] Args) {JFRM JF = New Gefram ("Demo"); Container cp = jf.getContentPane (); Cp.add (new JComponent () {Public Zero Paint Component (Graphics G) {Graphics 2DG2 = (Graphics 2D) G; G2 Asset Steak (New Basic Stroke (10)); G2 Dre (New Line 2 D. Float (30, 20, 80, 90));}}); Jf.setSize (300, 200); Jf.setVisible (true); }}

Enter image details here

(Note that the setStroke method is not available in graphics item. You must enter it in the Graphics2D object.)


This article has been rewritten as an article.


Comments