Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: help in update and repaint() methods (Grahpics2D)

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help in update and repaint() methods (Grahpics2D)

    hi everyone

    i'm trying to draw a line in a picture object. but i want to move or change the position of the line on that pic.

    is there a way of doing that?

    i'm using Graphics to drawLine(int x1,int y1,int x2,int y2) to draw the line on that pic.

    i want to make some motion

    thanks.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: help in update and repaint() methods (Grahpics2D)

    See How to Writer a Mouse Listener and Mouse Motion Listener. Change the coordinates of the line based upon mouse clicks and mouse motion

  3. #3
    Member
    Join Date
    Nov 2010
    Location
    New Zealand
    Posts
    32
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: help in update and repaint() methods (Grahpics2D)

    Quote Originally Posted by Nawaf View Post
    i'm trying to draw a line in a picture object. but i want to move or change the position of the line on that pic.
    Hey Nawaf,


    I wrote a program like that a while ago, based on an online tutorial. I can't seem to find the tutorial anymore, but here is the original program: DragKing


    I hope this helps.

    Cheers,

    Alice

Similar Threads

  1. repaint panel without clearing it
    By enflation in forum Java Theory & Questions
    Replies: 5
    Last Post: June 27th, 2010, 04:00 PM
  2. Repaint,
    By Time in forum AWT / Java Swing
    Replies: 3
    Last Post: May 21st, 2010, 11:23 PM
  3. Repaint doesn't repaint?
    By PotataChipz in forum AWT / Java Swing
    Replies: 6
    Last Post: January 18th, 2010, 09:56 PM
  4. Replies: 1
    Last Post: October 23rd, 2009, 03:17 PM