import java.awt.*; import javax.swing.*; import java.util.*; public class TestArrayOfDigitalClocks extends JFrame { public TestArrayOfDigitalClocks(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container content = getContentPane(); content.setLayout(new FlowLayout(FlowLayout.CENTER,1,1)); ArrayList clocks = new ArrayList(); Font clockFont = new Font("Courier",Font.BOLD,20); // construct the clocks and add to them to the JFrame for( int i = 0; i < 48; i++ ) { clocks.add(new DigitalClock(Color.red,Color.white,clockFont)); content.add((DigitalClock)clocks.get(i)); } // end for // start the clocks for( int i = 0; i < clocks.size(); i++ ) { ((DigitalClock)clocks.get(i)).start(); } // end for } public static void main(String[] args) { TestArrayOfDigitalClocks clocksFrame = new TestArrayOfDigitalClocks("Array of Digital Clocks"); clocksFrame.setSize(800,700); clocksFrame.setVisible(true); } // end main } // end TestArrayOfDigitalClocks