• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

help me it is a simple code but i need help

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ashutosh Raikvar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic