From 7df6aef0905457590292a43f5639f44719da34ec Mon Sep 17 00:00:00 2001 From: COLIN Cyril Date: Wed, 16 Oct 2019 13:50:27 +0200 Subject: [PATCH] added padding --- src/gui/ElevatorApplication.java | 4 +++- src/gui/ElevatorPanel.java | 3 +++ src/gui/FloorPanels.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/ElevatorApplication.java b/src/gui/ElevatorApplication.java index 0c1b2e0..96a9593 100644 --- a/src/gui/ElevatorApplication.java +++ b/src/gui/ElevatorApplication.java @@ -43,11 +43,13 @@ public class ElevatorApplication implements ActionListener { canvas.setAlignmentY(Component.TOP_ALIGNMENT); pane.add(canvas); + pane.add(Box.createRigidArea(new Dimension(40, 0))); + FloorPanels fp = new FloorPanels(5, simulation); fp.setAlignmentY(Component.TOP_ALIGNMENT); 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.setAlignmentY(Component.TOP_ALIGNMENT); diff --git a/src/gui/ElevatorPanel.java b/src/gui/ElevatorPanel.java index b393d56..2893cd9 100644 --- a/src/gui/ElevatorPanel.java +++ b/src/gui/ElevatorPanel.java @@ -1,6 +1,7 @@ package gui; import javax.swing.*; +import java.awt.*; import java.awt.event.*; import commandSystem.ElevatorListener; @@ -26,6 +27,7 @@ class ElevatorPanel extends JPanel { } }); this.add(buttons[i]); + this.add(Box.createRigidArea(new Dimension(0, 5))); } emergencyStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -33,6 +35,7 @@ class ElevatorPanel extends JPanel { } }); add(emergencyStop); + this.add(Box.createRigidArea(new Dimension(0, 5))); cancelEmergencyStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { l.cancelEmergency(); diff --git a/src/gui/FloorPanels.java b/src/gui/FloorPanels.java index 6f3e983..4378203 100644 --- a/src/gui/FloorPanels.java +++ b/src/gui/FloorPanels.java @@ -22,6 +22,7 @@ class FloorPanels extends JPanel { floors[i] = new JPanel(); floors[i].setLayout(new BoxLayout(floors[i], BoxLayout.LINE_AXIS)); floors[i].add(new JLabel("" + i)); + floors[i].add(Box.createRigidArea(new Dimension(5, 0))); if (i < nbFloors - 1) { final int j = i; JButton upButton = new JButton("↑"); @@ -31,6 +32,7 @@ class FloorPanels extends JPanel { } }); floors[i].add(upButton); + floors[i].add(Box.createRigidArea(new Dimension(5, 0))); } if (i > 0) { final int j = i; @@ -43,6 +45,7 @@ class FloorPanels extends JPanel { floors[i].add(downButton); } this.add(floors[i]); + this.add(Box.createRigidArea(new Dimension(0, 5))); } } }