|
@@ -45,6 +45,8 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
private JLabel labelID = new JLabel();
|
|
private JLabel labelID = new JLabel();
|
|
|
|
|
|
public MyCanvas(final Model model, Control control) {
|
|
public MyCanvas(final Model model, Control control) {
|
|
|
|
+ this.add(labelID);
|
|
|
|
+ labelID.setSize(GlobalVariables.SCALE/2, GlobalVariables.SCALE/2);
|
|
this.controller = control;
|
|
this.controller = control;
|
|
this.model = model;
|
|
this.model = model;
|
|
popmenu.add(itemDelete);
|
|
popmenu.add(itemDelete);
|
|
@@ -167,14 +169,15 @@ class MyCanvas extends JPanel implements MouseListener, MouseMotionListener {
|
|
y = e.getY();
|
|
y = e.getY();
|
|
int cx;
|
|
int cx;
|
|
int cy;
|
|
int cy;
|
|
- tempCps = null;
|
|
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
cx = cps.getPos().x;
|
|
cx = cps.getPos().x;
|
|
cy = cps.getPos().y;
|
|
cy = cps.getPos().y;
|
|
if (x - GlobalVariables.SCALE <= cx && y - GlobalVariables.SCALE <= cy && x >= cx && y >= cy) {
|
|
if (x - GlobalVariables.SCALE <= cx && y - GlobalVariables.SCALE <= cy && x >= cx && y >= cy) {
|
|
labelID.setText("ID: "+cps.getID());
|
|
labelID.setText("ID: "+cps.getID());
|
|
labelID.setLocation(cx, cy);
|
|
labelID.setLocation(cx, cy);
|
|
- System.out.println("show");
|
|
|
|
|
|
+ System.out.println("show ID: "+cps.getID());
|
|
|
|
+ } else {
|
|
|
|
+ labelID.setText("");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|