IMPLEMENTING-ANIMATION
what i want:-
i want the text(on left)to change when i press R.H.S button and animation(a circle moving downwards) to run when i press South side button.
what i am getting:-
what i am getting is rapid movement of circle also when i press LHS which has no relation with the circle thing the color of circle changes.
some1 plse help me......
thanks in adv T_T
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
1) never use Thread.sleep in Swing's EDT, use a Timer
2) int x=70,y=70;
should be in DrawPanel, that way the class can be re-used in applets, frames etc,
as is, it can't.
3) do you really want the color of the background and ball to change 20 times per second?
and at random times when the panel is painted? (this happens more often than most realize)
4) class Label implements ActionListener is really a poor choice for a name - there exists an awt class Label = confusion/conflict
that should do for starters
Ashutosh Raikvar
Greenhorn
Joined: Feb 13, 2012
Posts: 3
posted
0
here is some other working code (with animation working and no major GUI).my code has flaws i would appreciate if you change it to work the way i want it to work.one more thing above code i copied from head-first java book
I have added code tags to both your posts. Notice how it is now context high-lighted, and the formatting is preserved? This make it MUCH easier to read.
Next time, after you past your code in, highlight it all and hit the little 'code' formatting button - just like you wanted to make it italic or bold.
Never ascribe to malice that which can be adequately explained by stupidity.
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
Ashutosh Raikvar wrote:here is some other working code (with animation working and no major GUI).my code has flaws i would appreciate if you change it to work the way i want it to work.one more thing above code i copied from head-first java book
And what would you learn if someone did that for you ? It's much better if you make the changes you need and then if you come across a specific problem you can ask about it here.
Joanne
Ashutosh Raikvar
Greenhorn
Joined: Feb 13, 2012
Posts: 3
posted
0
Right now i dont have sufficient knowledge of java programming so i guess i will be able to identify the problem after spending more time programming.thanks for every thing