doesn’t compile lol
This commit is contained in:
parent
afeb28bc1e
commit
7649656e64
@ -1 +1 @@
|
|||||||
Main-Class: ElevatorApplication
|
Main-Class: gui.ElevatorApplication
|
||||||
|
4
Makefile
4
Makefile
@ -6,7 +6,7 @@ build:
|
|||||||
javac -Xlint $(shell find src -type f -name '*.java') -d build
|
javac -Xlint $(shell find src -type f -name '*.java') -d build
|
||||||
|
|
||||||
assemble:
|
assemble:
|
||||||
cd build/; jar cvmf ../MANIFEST.MF ../Elevator.jar *.class
|
cd build/; jar cvmf ../MANIFEST.MF ../Elevator.jar $(shell cd build/; find -type f -name '*.class')
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm build/*.class
|
-rm -r build/*
|
||||||
|
@ -39,7 +39,7 @@ public class ElevatorApplication implements ActionListener {
|
|||||||
canvas.setAlignmentY(Component.TOP_ALIGNMENT);
|
canvas.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||||
pane.add(canvas);
|
pane.add(canvas);
|
||||||
|
|
||||||
FloorPanels fp = new FloorPanels(5);
|
FloorPanels fp = new FloorPanels(5, simulation);
|
||||||
fp.setAlignmentY(Component.TOP_ALIGNMENT);
|
fp.setAlignmentY(Component.TOP_ALIGNMENT);
|
||||||
pane.add(fp);
|
pane.add(fp);
|
||||||
|
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
import commandSystem.ElevatorListener;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
class FloorPanels extends JPanel {
|
class FloorPanels extends JPanel {
|
||||||
private int nbFloors;
|
private int nbFloors;
|
||||||
private JPanel[] floors;
|
private JPanel[] floors;
|
||||||
|
|
||||||
public FloorPanels(int nbFloors) {
|
public FloorPanels(int nbFloors, ElevatorListener l) {
|
||||||
this.nbFloors = nbFloors;
|
this.nbFloors = nbFloors;
|
||||||
floors = new JPanel[nbFloors];
|
floors = new JPanel[nbFloors];
|
||||||
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
||||||
@ -18,8 +21,14 @@ class FloorPanels extends JPanel {
|
|||||||
floors[i] = new JPanel();
|
floors[i] = new JPanel();
|
||||||
floors[i].setLayout(new BoxLayout(floors[i], BoxLayout.LINE_AXIS));
|
floors[i].setLayout(new BoxLayout(floors[i], BoxLayout.LINE_AXIS));
|
||||||
floors[i].add(new JLabel("" + (i + 1)));
|
floors[i].add(new JLabel("" + (i + 1)));
|
||||||
floors[i].add(new JButton("↑"));
|
if (i < nbFloors - 1) {
|
||||||
floors[i].add(new JButton("↓"));
|
JButton upButton = new JButton("↑");
|
||||||
|
floors[i].add(upButton);
|
||||||
|
}
|
||||||
|
if (i > 1) {
|
||||||
|
JButton downButton = new JButton("↓");
|
||||||
|
floors[i].add(downButton);
|
||||||
|
}
|
||||||
this.add(floors[i]);
|
this.add(floors[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user