| | |
Drawing lines by click two points
![]() |
I have a GUI that displays a graph and I want to have some help with a code that allows you to click a point and then another point and then it draws a line. I need some help with this because I don't know were to start.
PETA People for the Eating of Tasty Animals.
FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
ok but how is that info stored?
PETA People for the Eating of Tasty Animals.
FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
you can store it in a double:
double x1 = Event.getX();
double y2 = Event.getY();
I don't know how you are going to tell if the first points were clicked unless you use a boolean...Like that boolean is set to true if the frst points are clicked, and then set to false..If that boolean is set to false, y would then store to the points in the second set of coordinates:
double x2 = Event.getX();
double y2 = Event.getY();
double x1 = Event.getX();
double y2 = Event.getY();
I don't know how you are going to tell if the first points were clicked unless you use a boolean...Like that boolean is set to true if the frst points are clicked, and then set to false..If that boolean is set to false, y would then store to the points in the second set of coordinates:
double x2 = Event.getX();
double y2 = Event.getY();
![]() |
Similar Threads
- Draw lines on panel (Java)
- Graphics in Pixel,Mode13h:Part 1 (C++)
- Word 2002 hogs CPU with Visio drawing embedded. (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: Printing from java
- Next Thread: graphics / compiler problem
| Thread Tools | Search this Thread |
account android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer homework html ide image inheritance integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux loop method midlethttpconnection migrate mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program property ria scanner server set sharepoint smart sms smsspam sourcelabs splash sql sqlite subclass support swing testautomation textfield threads tree trolltech unlimited utility windows






