This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Help needed with the Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help needed with the Code" Watch "Help needed with the Code" New topic
Author

Help needed with the Code

kartik rathore
Greenhorn

Joined: Oct 18, 2008
Posts: 14
hi, iv been trying to design a bouncing ball program whose code is under but i dont seem to find the problem as its not drawing the ball.

i would really appreciate if any one could make the correctiion to the code for me so that it shows the ball bouncing

thanks

///////////////////////////////////////////////////////////////////////////


[MG Edited for code tags]

[ November 02, 2008: Message edited by: Maneesh Godbole ]

[ November 02, 2008: Message edited by: kartik rathore ]
[ November 02, 2008: Message edited by: Bear Bibeault ]
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Kartik,

A few things:
1) Ease Up
2) Use Code Tags. I have edited your original post. As you can see it is much easier for everyone to read as it is properly indented.

I noticed you have a very similar post here.
Incidently in this post too, Pete Stein had requested you to Ease Up and use the Code Tags.
Craig Wood had been most helpful there by posting a workable code.
Did you try it out? Did it work?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
kartik rathore
Greenhorn

Joined: Oct 18, 2008
Posts: 14
hi
i did try the code that was posted by craig wood but it didnt seem to work so i tried to make sum changes into it and still i just dnt seem to have the graphics working in the program at all ....
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Well, one hint is that you don't call "paintComponent()" yourself. You call "repaint" and let Java call paintComponent() for you -- as any working examples you've looked at would undoubtedly show.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help needed with the Code