Results 1 to 13 of 13
- 12-29-2008, 02:05 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
- 12-29-2008, 02:29 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Why don't you work on with multiple threads?
- 12-29-2008, 02:31 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
ya i can work on multiple threads.... but i want espicially using timer class...can any one help me regarding this...
- 12-29-2008, 02:37 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Use the Timer class as an inner class, with passing the time period. Check the specific condition, may be complete the move of an image, and stop the time. Something like this.
Please check the code before use, I've not tested it, simply typed here.Java Code:public void moveImages(int time) { Timer timer = new Timer(time, new ActionListener() { public void actionPerformed(ActionEvent e) { // Do the impage moving process // Then stop the timer ((Timer)e.getSource()).stop(); } }); timer.start(); }
- 12-29-2008, 02:51 PM #5
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
hey moderator thank u very much for ur reply..... if u dont mind can u give me ur online chatting id so that i can chat with u.... pls give me...
- 12-29-2008, 03:00 PM #6
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
hey can u be more specific.... actually consider one image is falling at a speed of 2 secs and suppose another image name cursor i want to move that cursor with different speed so that i have to give two time periods...
- 12-29-2008, 03:02 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 12-29-2008, 03:33 PM #8
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
yeah i added u..... waiting for ur response....
- 12-29-2008, 03:45 PM #9
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
public MoveImage(){
Timer timer = new Timer(1000,this);
timer.start();
}
public void actionPerformed(ActionEvent e){
cursor.move();//here i want to give different speed to my cursor image.. how to do that.
image.move();
}
so from the above line i want to give different time to cursor using timer class alone... pls help me regarding this....
-
cross-posted in the sun java forums
- 12-29-2008, 04:06 PM #11
Member
- Join Date
- Oct 2008
- Posts
- 17
- Rep Power
- 0
hey wats wrong in that.... i want to get the solution thats y i posted in various forums... is it wrong....
-
Did you read what I wrote in the cross-post?
As stated there: This will frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread. For this reason, many volunteers here and at the other sites refuse to help repeat offenders.
It's up to you of course, since no one can stop you from doing it. But ask yourself this: "will I ever want to ask for help in either of these two forums again?" and then act according to what will be most beneficial to you in the future. Good luck.Last edited by Fubarable; 12-29-2008 at 04:34 PM.
- 12-30-2008, 02:30 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I'm really wired with this Fubarable. Why people doing this. Why we spend our valuable for such things.
Similar Threads
-
Drawing charts using swings
By ravindarjobs in forum New To JavaReplies: 19Last Post: 07-21-2009, 11:03 PM -
awt and swings
By masa in forum AWT / SwingReplies: 2Last Post: 11-24-2008, 07:09 AM -
More efficient in memory? Multiple Jars or Single Jars with lot's of Classes
By dark_cybernetics in forum New To JavaReplies: 0Last Post: 08-19-2008, 04:44 PM -
How to cancel an individual timer in spite of canceling whole timer
By Java Tip in forum java.utilReplies: 0Last Post: 04-04-2008, 02:46 PM -
java swings
By emperoraj in forum AWT / SwingReplies: 0Last Post: 03-26-2008, 11:50 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks