merge avec le github + j'ai mis les trucs de l'interface dans un package gui

This commit is contained in:
MathieuPietri
2019-10-11 17:59:39 +02:00
parent aa0b3a6bb4
commit e0280d7e18
17 changed files with 362 additions and 0 deletions

View File

@ -0,0 +1,42 @@
package gui;
import javax.swing.*;
import java.awt.*;
class ElevatorCanvas extends JPanel {
private final static int WIDTH = 40;
private final static int HEIGHT = 50;
private final static Color COLOR = Color.PINK;
private final static Dimension DIMENSIONS = new Dimension(WIDTH, 200);
private int y = 0;
@Override
public Dimension getMinimumSize() {
return DIMENSIONS;
}
@Override
public Dimension getPreferredSize() {
return DIMENSIONS;
}
@Override
public Dimension getMaximumSize() {
return DIMENSIONS;
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(COLOR);
g.fillRect(0, y, WIDTH, HEIGHT);
}
public void setElevatorY(int y) {
this.y = y;
repaint();
}
public int getElevatorY() {
return y;
}
}