Hi i am new to java... i want to make a display an image of a ball in png format.. the program will be animated i.e the ball will move.. the display will be in a window.. the program is a console app not an applet.. The ball is a separate class... the window will be created by a separate class(main class)... Can you please help me.. i am gettin the initial window but cannot display the ball..the initial winow is from a class using JFrame... thanks in advance
07-18-2006, 02:47 PM
A very short design suggestion:
Make a JPanel extension, override the paintComponent method and draw the ball there. Stuff this panel into the JFrame, implement a thread in the JPanel extension. In its run method you code a loop/sleep that increments the ball coordinates as appropriate and repaints the panel on each loop.