yeah sorry, i saw how to input code after i posted my problem.
here is the code again, this time in correct position:
Timer clock = new Timer( 100 , this );
public void paintComponent( Graphics g )
super.paintComponent( g );
g.fillRect( 0 , 0 , getWidth() , getHeight() );
g.setColor( new Color( 255 , 255 , 255 ) );
g.fillOval( x + movement , 0 + y , 20 , 20 );
public void bereken()
movement += randomMovement.nextInt( 21 ) - 11;
y += 20;
if ( y > getHeight() )
y = 0;
x = randomStart.nextInt( getWidth() );
if ( x > getWidth() )
x = 0;
public void actionPerformed( ActionEvent e )
this time with more detailed instructions on what i'm trying to achieve and the attempts already made.
the goal of my application is that it creates a multiple amount of objects that move downwards at a previous set speed, with randomised horizontal movement (snowflakes).
the graphics of the object are of later concern, first i have to tackle my problem with generating multiple objects.
i tried using for/while loops in the paintComponent, which mostly ended in exceptions or creating objects that had the same horizontal position and/or the same randomised movement.
i tried making arrays for different x-co÷rdinates and different random movements, which 9/10 times ended in exceptions or problems with the declarations and reading of the arrays.
i attempted every method, algorithm and combinations i learned so far but i'm really stuck on this one.
if you have some hints or tips on this matter, please let me know.
with kind regards, l.oomen