--- /dev/null
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+public class FrGraf extends Frame implements Observer
+{
+ private Panel panel;
+ private Label label;
+
+ public FrGraf (Fraccion f)
+ {
+ panel = new Panel ();
+ label = new Label(f.toString (), Label.CENTER);
+
+ panel.setLayout (new BorderLayout ());
+ panel.add (label, BorderLayout.CENTER);
+
+ add (panel, BorderLayout.CENTER );
+ setSize (500, 300);
+ setVisible (true);
+
+ f.addObserver (this);
+ }
+
+ public void update(Observable obs, Object obj)
+ {
+ if (obj instanceof Fraccion) {
+ label.setText (obj.toString ());
+ } else {
+ label.setText ("E");
+ }
+ }
+
+ static public void main (String[] args) {
+ Fraccion modelo = null;
+ try {
+ modelo = new Fraccion (5, 4);
+ }
+ catch (Exception e) {
+ }
+
+ FrGraf vista = new FrGraf (modelo);
+ }
+}