connect simulation to display

This commit is contained in:
COLIN Cyril
2019-10-16 13:35:26 +02:00
parent 579f33d34e
commit f58b035252
4 changed files with 38 additions and 43 deletions

View File

@ -11,7 +11,6 @@ class ElevatorCanvas extends JPanel {
private final static int HEIGHT = 50;
private final static Dimension DIMENSIONS = new Dimension(WIDTH, 200);
private int y = 0;
private Elevator elevator;
public ElevatorCanvas(Elevator elevator) {
@ -46,16 +45,7 @@ class ElevatorCanvas extends JPanel {
else {
g.setColor(Color.BLACK);
}
g.fillRect(0, y, WIDTH, HEIGHT);
g.fillRect(0, 200 - (int) Math.floor(elevator.getHeight() * 200) - HEIGHT, WIDTH, HEIGHT);
Toolkit.getDefaultToolkit().sync();
}
public void setElevatorY(int y) {
this.y = y;
repaint();
}
public int getElevatorY() {
return y;
}
}