|
@@ -111,6 +111,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
*/
|
|
|
public MyCanvas(Model mod, Control control) {
|
|
|
this.add(objectTT);
|
|
|
+ objectTT.setVisible(false);
|
|
|
this.controller = control;
|
|
|
this.model = mod;
|
|
|
|
|
@@ -435,10 +436,10 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
con.getA().getPosition().y + controller.getScaleDiv2(),
|
|
|
con.getB().getPosition().x + controller.getScaleDiv2(),
|
|
|
con.getB().getPosition().y + controller.getScaleDiv2());
|
|
|
-
|
|
|
+
|
|
|
if (con.getCapacity() == -1) {
|
|
|
maxCap = Character.toString('\u221e');
|
|
|
- } else if (con.getCapacity() == -2){
|
|
|
+ } else if (con.getCapacity() == -2) {
|
|
|
maxCap = "???";
|
|
|
} else {
|
|
|
maxCap = String.valueOf(con.getCapacity());
|
|
@@ -479,8 +480,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
con.getA().getPosition().y + controller.getScaleDiv2(),
|
|
|
con.getB().getPosition().x + controller.getScaleDiv2(),
|
|
|
con.getB().getPosition().y + controller.getScaleDiv2());
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if (con.getCapacity() == -1) {
|
|
|
maxCap = Character.toString('\u221e');
|
|
|
} else if (con.getCapacity() == -2) {
|
|
@@ -516,7 +516,6 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
edgeHighlight.getA().getPosition().y + controller.getScaleDiv2(),
|
|
|
edgeHighlight.getB().getPosition().x + controller.getScaleDiv2(),
|
|
|
edgeHighlight.getB().getPosition().y + controller.getScaleDiv2());
|
|
|
-
|
|
|
|
|
|
if (edgeHighlight.getCapacity() == -1) {
|
|
|
maxCap = Character.toString('\u221e');
|
|
@@ -860,20 +859,18 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
|
// Everytghing for the tooltip :)
|
|
|
boolean on = false;
|
|
|
for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
-
|
|
|
cx = cps.getPosition().x;
|
|
|
cy = cps.getPosition().y;
|
|
|
if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
|
|
|
-
|
|
|
objectTT.setLocation(cx, cy + controller.getScale());
|
|
|
objectTT.setTipText(cps.getName() + ", " + cps.getID());
|
|
|
-
|
|
|
on = true;
|
|
|
}
|
|
|
}
|
|
|
- if (!on) {
|
|
|
- objectTT.setTipText("");
|
|
|
- objectTT.setLocation(-200, -200);
|
|
|
+ if (on) {
|
|
|
+ objectTT.setVisible(true);
|
|
|
+ } else {
|
|
|
+ objectTT.setVisible(false);
|
|
|
}
|
|
|
}
|
|
|
|