From b820f041ae470de7a40a842cd6ad53512a1bf214 Mon Sep 17 00:00:00 2001 From: COLIN Cyril Date: Mon, 14 Oct 2019 13:38:17 +0200 Subject: [PATCH 1/2] fix makefile --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3901323..2ae09e9 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,14 @@ all: build assemble +rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) + .PHONY: build build: mkdir -p build javac -Xlint $(shell find src -type f -name '*.java') -d build assemble: - cd build/; jar cvmf ../MANIFEST.MF ../Elevator.jar $(shell cd build/; find -type f -name '*.class') + cd build/; jar cvmf ../MANIFEST.MF ../Elevator.jar $(patsubst %,'%',$(shell cd build; find -name '*.class')) clean: -rm -r build/* From 771d76da3f73513cd0fd9c5019d00d022f48ae44 Mon Sep 17 00:00:00 2001 From: COLIN Cyril Date: Mon, 14 Oct 2019 13:43:04 +0200 Subject: [PATCH 2/2] fix stage ordering --- src/gui/ElevatorPanel.java | 2 +- src/gui/FloorPanels.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/ElevatorPanel.java b/src/gui/ElevatorPanel.java index b9f1fb4..2d8e6f7 100644 --- a/src/gui/ElevatorPanel.java +++ b/src/gui/ElevatorPanel.java @@ -13,7 +13,7 @@ class ElevatorPanel extends JPanel { this.add(new JLabel("Elevator panel.")); buttons = new JButton[nbFloors]; - for (int i = 0; i < nbFloors; i++) { + for (int i = nbFloors-1; i >= 0; i--) { buttons[i] = new JButton("" + i); this.add(buttons[i]); } diff --git a/src/gui/FloorPanels.java b/src/gui/FloorPanels.java index fb0c0be..529a4a0 100644 --- a/src/gui/FloorPanels.java +++ b/src/gui/FloorPanels.java @@ -17,15 +17,15 @@ class FloorPanels extends JPanel { floors = new JPanel[nbFloors]; this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.add(new JLabel("Call.")); - for (int i = 0; i < nbFloors; i++) { + for (int i = nbFloors-1; i >= 0; i--) { floors[i] = new JPanel(); floors[i].setLayout(new BoxLayout(floors[i], BoxLayout.LINE_AXIS)); - floors[i].add(new JLabel("" + (i + 1))); + floors[i].add(new JLabel("" + i)); if (i < nbFloors - 1) { JButton upButton = new JButton("↑"); floors[i].add(upButton); } - if (i > 1) { + if (i > 0) { JButton downButton = new JButton("↓"); floors[i].add(downButton); }