Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is it possible to draw a polygon or a line more than 1 pixel wide?

0
Posted

Is it possible to draw a polygon or a line more than 1 pixel wide?

0

Ans : JDK 1.1 doesn’t have support for this. The standard workaround for drawing a thick line is to draw a filled polygon. The standard workaround for drawing a thick polygon is to draw several polygons. There is a useful class at http://www.apl.jhu.edu/~hall/java/GraphicsUtil.html which extends the drawxxx and fillxxx methods of java.awt.Graphics. It adds a Line Width argument to most of the drawxxx methods, a Color argument to most of the drawxxx and fillxxx methods, and a Font argument to drawString and drawChars. JDK 1.2 introduces the java.awt.BasicStroke class. You set the stroke on a Graphics object, and line rendering is done using that info. BasicStroke bs = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, null, 0.0f); g.setStroke(bs); g.drawLine( …

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.