Hi Cris,
thanks for reply. i run jdk 1.4.2
thanks in advance
thanasis
On Nov 22, 2005, at 5:10 PM, Thanasis (Hotmail) wrote:
Hi Chris,
thanks for reply.What i want to achieve is to draw a dotted line
when i pass a Graphics2D object and a solid line when
i pass a Graphics object.The problem is that even if i pass a
graphics object to drawArrow method i get a dotted line.
Why does this happen?
In JDK 1.2 and above, in most situations when you see Graphics as a
parameter in Swing/AWT methods, it will actually be an instance of
Graphics2D. If you run on an older JDK (like Microsoft's JDK 1.1),
it will not be an instance of Graphics2D (since that was introduced
in JDK 1.2).
Chris
===============================================
public void drawArrow(Graphics g, int x1, int y1, int x2, int y2){
if ( g instanceof Graphics2D ){
Graphics2D g2=(Graphics2D)g;
g2.setStroke (new BasicStroke(1f,BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND,1f,new float[] {5f, 7f }, 0f));
}
g.drawLine(x1,y1,x2,y2);
}//end of method
=================================================
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".