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
Joined: Jun 09, 2003
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
Joined: Feb 13, 2012
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.
Joined: Aug 05, 2005
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.
Joined: Feb 13, 2012
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