Search:

Type: Posts; User: ice

Search: Search took 0.08 seconds.

  1. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    oh, my god! It finally did it! =D>
    Thank u a lot copeg!!!
    :)
  2. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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...
  3. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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;
    ...
  4. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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...
  5. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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...
  6. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    Hi guys, don't give up here yet, the problem is still not solved yet.

    :-w
  7. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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
  8. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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...
  9. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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...
  10. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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()
    ...
  11. Replies
    21
    Views
    6,308

    Re: How to drag the shape to move?

    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,...
  12. Replies
    21
    Views
    6,308

    How to drag the shape to move?

    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,...
Results 1 to 12 of 13