CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: movable paint

  1. #1
    Join Date
    Dec 2008
    Posts
    27

    movable paint

    how would i go about making a movable paint i know how to make the paint just not so that it can be moved around.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: movable paint

    That doesn't really make sense, can you describe what you are trying to achieve.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Oct 2010
    Posts
    15

    Re: movable paint

    hmmm... mix some paint in a bucket, pick it up, move it -- there ya go, movable paint!

  4. #4
    Join Date
    Dec 2008
    Posts
    27

    Re: movable paint

    ok here is what i am trying to do
    Code:
    g.drawString("hello",20 ,20);
    i want to be able to take that when compiled and run and be able to move it around the screen.

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: movable paint

    Change your hard coded location values into variables and change their values to the screen location you want to draw the string at.

    BTW how do you want to be able to move it around the screen?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  6. #6
    Join Date
    Dec 2008
    Posts
    27

    Re: movable paint

    i want to be able to move it around by mouse.

  7. #7
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: movable paint

    OK so add a MouseMotionListener to your panel and in the mouseMoved() method (if you want it to always follow the mouse) or the mouseDragged() method (if you want to click and drag it around the panel) change the location variables to the mouse's current location and call repaint().
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured