setLayout(new BorderLayout());
// create a double buffer panel and add it to the
// center of the frame
DoubleBufferPanel dbp = new DoubleBufferPanel();
dbp.setLayout(new BorderLayout());
add("Center", dbp);
// create a pretty panel and add it to the
// double buffer panel
//needed because ExampleApplet is running under Switcher
Applet parentApplet;
//Get the parent Applet object.
try {
parentApplet = (Applet)getParent();
PrettyPanel pp = new PrettyPanel(parentApplet);
pp.setLayout(new FlowLayout());
dbp.add("Center", pp);
// *** Create Gauges
Gauge gauge1 = new Gauge(Color.green.darker());
pp.add(gauge1);
Gauge gauge2 = new Gauge(Color.red.darker());
pp.add(gauge2);
Gauge gauge3 = new Gauge(Color.cyan);
pp.add(gauge3);
Gauge gauge4 = new Gauge();
pp.add(gauge4);
Gauge gauge5 = new Gauge(Color.blue.darker());
pp.add(gauge5);
Gauge gauge6 = new Gauge(Color.pink.darker());
pp.add(gauge6);
Gauge gauge7 = new Gauge(Color.yellow);
pp.add(gauge7);
// *** Create threads to drive the gauges
GaugeThread gaugeThread1 = new GaugeThread(gauge1);
gaugeThread1.start();
GaugeThread gaugeThread2 = new GaugeThread(gauge2);
gaugeThread2.start();
GaugeThread gaugeThread3 = new GaugeThread(gauge3);
gaugeThread3.start();
GaugeThread gaugeThread4 = new GaugeThread(gauge4);
gaugeThread4.start();
GaugeThread gaugeThread5 = new GaugeThread(gauge5);
gaugeThread5.start();
GaugeThread gaugeThread6 = new GaugeThread(gauge6);
gaugeThread6.start();
GaugeThread gaugeThread7 = new GaugeThread(gauge7);
gaugeThread7.start();
} catch (ClassCastException e) {
System.err.println("Parent isn't an Applet!");
throw(e);
}