checkpoint
[anneal.git] / src / edu / berkeley / qfat / InteractiveMeshViewer.java
index ed23803..e024d04 100644 (file)
@@ -11,27 +11,36 @@ import java.util.*;
 import edu.berkeley.qfat.geom.*;
 import edu.berkeley.qfat.geom.Point;
 
-public class InteractiveMeshViewer extends MeshViewer {
+public class InteractiveMeshViewer extends JPanel {
 
     public Mesh tile;
     public Mesh goal;
+
+    private MeshViewer mv;
+
     public InteractiveMeshViewer(JFrame f) {
-        super(f);
+        mv = new MeshViewer();
+        setLayout(new BorderLayout());
+        this.add(mv, BorderLayout.CENTER);
         setTile(new Mesh(false));
         setGoal(new Mesh(false));
     }
+    public void repaint() {
+        if (mv != null) mv.repaint();
+    }
+
 
     public void setTile(Mesh tile) {
-        removeMesh(this.tile);
+        mv.removeMesh(this.tile);
         this.tile = tile;
-        addMesh(this.tile);
+        mv.addMesh(this.tile);
     }
     public void setGoal(Mesh goal) {
-        removeMesh(this.goal);
+        mv.removeMesh(this.goal);
         this.goal = goal;
         goal.option_selectable = false;
         goal.option_wireframe = true;
-        addMesh(this.goal);
+        mv.addMesh(this.goal);
     }
 
     public synchronized void dump() {
@@ -75,7 +84,7 @@ public class InteractiveMeshViewer extends MeshViewer {
     public    int vertss;
 
     public void keyPressed(KeyEvent e)  {
-        super.keyPressed(e);
+        //super.keyPressed(e);
         switch(e.getKeyCode()) {
             case KeyEvent.VK_SPACE: breaks++; force = true; break;
             case KeyEvent.VK_UP: temp = temp * 2; break;