renovatiotr 0 Newbie Poster

I have a HW. It must be sent to the teacher in 12 hours. Any help would be great.

I need to do this using JSplitPane: http://javafaq.nu/free-swing-book/Chapter8_files/image002.gif

There are moving balls in seperate panels(not imaages). Smaller the panel's area, faster the balls move.

I did the JSplitPane and Panels but failed to do the Moving Balls Part.

import java.awt.*;
import javax.swing.*;

public class SplitPane extends JPanel{
	
	
  public static void main(String[] a) {
	 
	

    JFrame horizontalFrame = new JFrame();
   horizontalFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    JPanel panel1 = new JPanel(new BorderLayout());
	

    
    JPanel panel2 = new JPanel(new BorderLayout());
 
    final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    splitPane.setLeftComponent(panel1);
    splitPane.setBottomComponent(panel2);

    horizontalFrame.add(splitPane, BorderLayout.CENTER);
    horizontalFrame.setSize(500, 500);
    horizontalFrame.setVisible(true);

    splitPane.setDividerLocation(0.5);
  }
}

Simply, I need balls and need to know how to display these balls in panels i created.

I attached the HW. There is a full explanation.

As you understand, i'm really new at this. :)


Thanks in advance.