| | |
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 |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






