X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FInteractiveMeshViewer.java;h=e024d04b4cc56e6767a94bf649ada729129932f1;hp=ed238032db23e0dbf999db83a34215437471ce8c;hb=a834467308680ec7fc4a82e2f5998b85784a7572;hpb=85c64e9b1601906bea50c0e1f30f1d0471b80867 diff --git a/src/edu/berkeley/qfat/InteractiveMeshViewer.java b/src/edu/berkeley/qfat/InteractiveMeshViewer.java index ed23803..e024d04 100644 --- a/src/edu/berkeley/qfat/InteractiveMeshViewer.java +++ b/src/edu/berkeley/qfat/InteractiveMeshViewer.java @@ -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;