This commit is contained in:
DylanVsn 2019-10-16 13:50:14 +02:00
commit 069ab2bd77
3 changed files with 9 additions and 1 deletions

View File

@ -43,11 +43,13 @@ public class ElevatorApplication implements ActionListener {
canvas.setAlignmentY(Component.TOP_ALIGNMENT); canvas.setAlignmentY(Component.TOP_ALIGNMENT);
pane.add(canvas); pane.add(canvas);
pane.add(Box.createRigidArea(new Dimension(40, 0)));
FloorPanels fp = new FloorPanels(5, simulation); FloorPanels fp = new FloorPanels(5, simulation);
fp.setAlignmentY(Component.TOP_ALIGNMENT); fp.setAlignmentY(Component.TOP_ALIGNMENT);
pane.add(fp); pane.add(fp);
pane.add(Box.createRigidArea(new Dimension(20, 0))); pane.add(Box.createRigidArea(new Dimension(40, 0)));
ElevatorPanel elevatorPanel = new ElevatorPanel(5, simulation); ElevatorPanel elevatorPanel = new ElevatorPanel(5, simulation);
elevatorPanel.setAlignmentY(Component.TOP_ALIGNMENT); elevatorPanel.setAlignmentY(Component.TOP_ALIGNMENT);

View File

@ -1,6 +1,7 @@
package gui; package gui;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import commandSystem.ElevatorListener; import commandSystem.ElevatorListener;
@ -26,6 +27,7 @@ class ElevatorPanel extends JPanel {
} }
}); });
this.add(buttons[i]); this.add(buttons[i]);
this.add(Box.createRigidArea(new Dimension(0, 5)));
} }
emergencyStop.addActionListener(new ActionListener() { emergencyStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -33,6 +35,7 @@ class ElevatorPanel extends JPanel {
} }
}); });
add(emergencyStop); add(emergencyStop);
this.add(Box.createRigidArea(new Dimension(0, 5)));
cancelEmergencyStop.addActionListener(new ActionListener() { cancelEmergencyStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
l.cancelEmergency(); l.cancelEmergency();

View File

@ -22,6 +22,7 @@ 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)); floors[i].add(new JLabel("" + i));
floors[i].add(Box.createRigidArea(new Dimension(5, 0)));
if (i < nbFloors - 1) { if (i < nbFloors - 1) {
final int j = i; final int j = i;
JButton upButton = new JButton(""); JButton upButton = new JButton("");
@ -31,6 +32,7 @@ class FloorPanels extends JPanel {
} }
}); });
floors[i].add(upButton); floors[i].add(upButton);
floors[i].add(Box.createRigidArea(new Dimension(5, 0)));
} }
if (i > 0) { if (i > 0) {
final int j = i; final int j = i;
@ -43,6 +45,7 @@ class FloorPanels extends JPanel {
floors[i].add(downButton); floors[i].add(downButton);
} }
this.add(floors[i]); this.add(floors[i]);
this.add(Box.createRigidArea(new Dimension(0, 5)));
} }
} }
} }