Results 1 to 4 of 4

Thread: move object

  1. #1 is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default move object

    I am a beginner in a java. Could you help me? I don't know how to make object move.
    I have a small rectange. And It has to move there where is a cursor.
    I think I have to make:
    public void mouseMoved(mouseEvent e)
    Point souradnice = e.getPoint();

    I don't know what to type next.
    Please, help me.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power


    Store the values where the rectangle is drawn in a class variable. Update that variable when the mouse is moved. Repaint.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3 is offline Member
    Join Date
    Jan 2011
    Rep Power


    I do it. But It does not work.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Quote Originally Posted by View Post
    I do it.
    You do what? You show us no code to prove what you've done.

    But It does not work.
    It doesn't work how? Please read Kevin's link on how to ask smart questions before replying. You are hiding information from us that we need.

Similar Threads

  1. Move from console to GUI
    By MaxMonic in forum Advanced Java
    Replies: 2
    Last Post: 01-01-2011, 07:34 AM
  2. How To Move An Object On A Random Path
    By burakesme in forum Java 2D
    Replies: 1
    Last Post: 05-23-2010, 06:22 PM
  3. Help Using KeyListener to Move an Object
    By jjonesmu in forum New To Java
    Replies: 3
    Last Post: 04-20-2010, 11:35 PM
  4. Replies: 1
    Last Post: 04-20-2010, 11:31 PM
  5. How do you move a picture?
    By Addez in forum New To Java
    Replies: 6
    Last Post: 11-03-2009, 09:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts