oh, my god! It finally did it! =D>
Thank u a lot copeg!!!
:)
Type: Posts; User: ice
oh, my god! It finally did it! =D>
Thank u a lot copeg!!!
:)
Wow, it does have some magic! Now mouseClick part works, selectedOctagon can get selected. But something odd happened: As soon as I start to drag selectedOctagon, it moves very very quickly to...
great, that souds promising, :) here is Octagon Class:
import java.awt.*;
import java.util.Random;
public class Octagon extends Polygon
{
private int[] x;
private int[] y;
...
ok, after I tidied up the code to new one below, I think I have found out a big error here:
selectedOctagon never got selected in the methods private Octagon hitTest(MouseEvent e) and public void...
In fact I don't know what exact I should print to analyse; then I tried to put System.out.println(xtrans + " " + ytrans);inside mousedragged method, is that right thing to print? but it print out...
Hi guys, don't give up here yet, the problem is still not solved yet.
:-w
Thanks copeg, but it didn't work out for me, I still don't know how to fix it. :o
Is there any way yo point out the error inside the code?
Thanks heaps
How could System.out.println help it? It just simply print text out, I still don't know what is going on. As for debugger, I am hopeless on that. :o
Is there other ways to tell whic part of code is...
Ah, I see what you mean - shoudl add both. Now I add both, then it comes back to the first place, which is I only can press to draw a polygon, but I still can't drag to move them.
Any more...
Hi copeg
Thank you for your advice, I have changed it to what you mean (in red), then it can't even draw any polygon when I press the mouse?
Any more thought?
public OctagonPanel()
...
Hi copeg,
I mean I want to drag the shape to the place where I release the mouse, but the shape doesn't move at all. I thnk I have specified what to do in the methods of mousePressed,...
Hi guys
Below code can press to draw a random polygon whenever the mouse is pressed. I also want to drag any polygon to anywhere I want, so I have add something in the methods of mousePressed,...