Home arrow static arrow Java Programming [Archive] - Draw a arrow
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Draw a arrow
This topic has 6 replies on 1 page.

Posts:48
Registered: 2/2/03
Draw a arrow  
Jun 9, 2003 5:32 AM



 
hello every1
i need to know if i can draw an arrow --> in 2D graphics

i know i can draw line by stating g.drawLine

but how can i draw some fink like -->

any help will be great full
 

Posts:100
Registered: 3/13/02
Re: Draw a arrow  
Jun 9, 2003 6:08 AM (reply 1 of 6)



 
Of course you can. An arrow is simply 3 lines is it not? Draw three lines with three calls to drawLine.
 

Posts:48
Registered: 2/2/03
Re: Draw a arrow  
Jun 9, 2003 6:31 AM (reply 2 of 6)



 
ahh ya off course you can.
but da problem with dat is setting your x's and y's,
any suggestion on that
 

Posts:100
Registered: 3/13/02
Re: Draw a arrow  
Jun 9, 2003 6:51 AM (reply 3 of 6)



 
It is very simple and only involves addition and/or subtraction. I'm not going to do it for you. If you can't do it then I hope programming is not your choosen profession...
 

Posts:2
Registered: 7/20/04
Re: Draw a arrow  
Jul 20, 2004 1:31 AM (reply 4 of 6)



 
Another way is to draw a line and a polygon as an arrow tip. The trickiest part is to get 3 points for the polygon. Hope this helps.
 

Posts:342
Registered: 5/22/98
Re: Draw a arrow  
Jul 20, 2004 2:09 AM (reply 5 of 6)



 
It is very simple and only involves addition and/or
subtraction.

This is not necessarily true, especially if you need the line is rotated. If it is rotated, you may need to perform a vector transformation. Take a look at Graphics2D and AfflineTransform for rotating shapes.

Hope this helps,

Graeme
 

Posts:342
Registered: 5/22/98
Re: Draw a arrow  
Jul 20, 2004 2:12 AM (reply 6 of 6)



 
especially if you need the line is rotated.

???

I really need to learn to proofread my posts. Sorry, this should read:

especially if the line is rotated.

Graeme
 
This topic has 6 replies on 1 page.