hello everybody, i am new to java and i am trying to move a circle from one to another end in the applet horizontally using threads. The problem is that after repaint(), the paint() should be called. But how the position is increment ie., x-axis is the problem. plz solve my problem khawal
I dont have the specifics of what you are doing but I would keep a couple of private variables x and y. x starts at 0 and y starts at getHeight() / 2. In run(), increment x by 10 (or some other value), then call Thread.sleep() for a bit, then repeat (using while loop). Dont forget to call repaint() each time that the x value changes. Hope that helps. ------------------ - Daniel
"mskhawal", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements. Thanks.