Line thickness on Paintable Canvas

Hi, I have the following code to draw a line in the Paintable Canvas:

[code]from java.awt import Color
from java.awt import Graphics
from java.awt import Graphics2D
from java.awt.geom import Line2D

g = event.graphics

g.setColor(Color.RED)
g.drawLine(event.source.xTA-7, event.source.yTA-9, event.source.xTB-7, event.source.yTB-9)[/code]

But I want to vary the thickness of the line. It seems that I might have to use setStroke in the Graphics2D object, but coding that is beyond me. Can anyone help here?

Thanks,
Cas

You can do the following:[code]from java.awt import Color
from java.awt import Graphics
from java.awt import Graphics2D
from java.awt.geom import Line2D
from java.awt import BasicStroke

g = event.graphics

g.setColor(Color.RED)
g.setStroke(BasicStroke(3))
g.drawLine(event.source.xTA-7, event.source.yTA-9, event.source.xTB-7, event.source.yTB-9)[/code]Notice the g.setStroke function call. Here is a list of functions you can use:

docs.oracle.com/javase/7/docs/ap … phics.html

Thanks, Travis. I will try this tonight.
So the key here is: “from java.awt import BasicStroke”?

Because setStroke & BasicStroke are in the Graphics2D class, it never worked for me when trying to use it under the regular Graphics class. All I was missing was to import the BasicStroke object?
Note, the setStroke reference wasn’t on the link that you provided, but it is on the Graphics2D page.
http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html

Thanks for the clarification.
Cas