This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to draw straight line instead of  curved line?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to draw straight line instead of  curved line??" Watch "How to draw straight line instead of  curved line??" New topic
Author

How to draw straight line instead of curved line??

Michelle Wang
Ranch Hand

Joined: Apr 17, 2007
Posts: 87
Dear friends:
I have following code, which can draw curved lines when mouse moves, but if I only hope to draw stright line, not curved one, How to draw straight line instead of curved line??

If can help advice something, thanks in advance.
Regards

Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
pressMouse -> start line
releaseMouse -> end line
Michelle Wang
Ranch Hand

Joined: Apr 17, 2007
Posts: 87
Excellent!! Thanks so much!!Super!!
[ June 21, 2007: Message edited by: girl sunny ]
Michelle Wang
Ranch Hand

Joined: Apr 17, 2007
Posts: 87
I have another idea after your wonderful code,
I tried but failed with following code, If I hope to apply your draw method in your reply post to the following code, is it possible or not, last night I tried hours, no success.

Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535

Edit:
Changed this line in ComponentMover.addLine

to this

to prevent the member variable firstLoc from changing values passed to previously
created instances of LineStore.
Also, replaced all loop count variables with letter j.
[ June 22, 2007: Message edited by: Craig Wood ]
Michelle Wang
Ranch Hand

Joined: Apr 17, 2007
Posts: 87
Great! Thanks a lot!!
justin joel
Greenhorn

Joined: Jun 29, 2007
Posts: 1
How to create a simple paint application?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to draw straight line instead of curved line??