summaryrefslogtreecommitdiff
path: root/src/graphyx/gui/InfoPanel.scala
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2009-11-05 21:02:40 +0000
committerJakob Odersky <jodersky@gmail.com>2009-11-05 21:02:40 +0000
commit9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70 (patch)
tree4e97fadc391b310ee1cc7156fda590dff414b2c3 /src/graphyx/gui/InfoPanel.scala
parent034bc5930ea6f01745f64a6070711d899d2c27ae (diff)
downloadsims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.tar.gz
sims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.tar.bz2
sims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.zip
Initial import.
Diffstat (limited to 'src/graphyx/gui/InfoPanel.scala')
-rw-r--r--src/graphyx/gui/InfoPanel.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/graphyx/gui/InfoPanel.scala b/src/graphyx/gui/InfoPanel.scala
new file mode 100644
index 0000000..484f3d7
--- /dev/null
+++ b/src/graphyx/gui/InfoPanel.scala
@@ -0,0 +1,28 @@
+/*
+ * Graphyx
+ * copyright (c) 2009 Jakob Odersky
+ * made available under the MIT License
+*/
+
+package graphyx.gui
+
+import scala.swing._
+class InfoPanel(container: Container) extends BoxPanel(Orientation.Vertical){
+ preferredSize = (200, 50)
+
+ val out = new TextArea
+ out.editable = false
+ contents += out
+ border = Swing.EmptyBorder(3,3,3,3)
+
+ def update() = {
+ out.text = "fps=" + container.scene.fps + "\n" +
+ "t=" + container.scene.world.time.formatted("%f") + "\n"
+ if (container.scene.world.overCWarning) {
+ out.foreground = java.awt.Color.red
+ out.text += "Warning: some bodies passed the speed of light! Simulation may be highly incorrect.\n"
+ }
+ else out.foreground = java.awt.Color.black
+ for (r <- container.scene.world.monitorResults) out.text += r + "\n"
+ }
+}