connect simulation to display
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user