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

/**
 *  This program holds two graphical components: a TextField and a
 *  JSlider.  The value shown by each component is the same.
 *  When one value changes as a result of a user action, the
 *  other value changes accordingly.
 */

public class Main {
    public static void main (String [] args) { 
	// The observer of the components.
	Observer observer = new Observer ();
	// The two components
	Digital digital = new Digital (observer);
	Analog analog = new Analog (observer);
	// Each component implements the same interface, Settable,
	// that ensures that the value of a component can be set.
	Settable [] settable = { digital, analog };
	// Set the observable in the observer
	observer.setSettable(settable);
	// Set the initial value
	digital.setInt (32);
	observer.update(digital,32);
        // Set the frame
	Frame frame = new Frame ("Observer");
	// Add the components
	frame.add("East", digital);
	frame.add("West", analog);
	frame.pack ();
	frame.show ();
	frame.setResizable (false);
    }
}
