Controle machine

This commit is contained in:
Simoes Lukas
2025-03-19 10:18:41 +01:00
parent 42cc204dea
commit 376861b608
86 changed files with 803 additions and 179 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

View File

@@ -0,0 +1,31 @@
import java.awt.*;
import javax.swing.*;
public class Fenetre extends JFrame {
public Fenetre() {
this.setSize(250, 300);
this.setLocation(100, 100);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new BorderLayout());
JPanel panneauHaut = new JPanel();
JPanel panneauBas = new JPanel();
JPanel panneauMilieu = new JPanel();
JButton boutonHaut = new JButton("\u25B2");
JButton boutonBas = new JButton("\u25BC");
Six imageSix = new Six();
boutonHaut.setHorizontalAlignment(JButton.CENTER);
boutonBas.setHorizontalAlignment(JButton.CENTER);
panneauHaut.add(boutonHaut);
panneauBas.add(boutonBas);
panneauMilieu.add(imageSix);
this.add(panneauHaut, BorderLayout.NORTH);
this.add(panneauBas, BorderLayout.SOUTH);
this.add(imageSix, BorderLayout.CENTER);
}
}

Binary file not shown.

View File

@@ -0,0 +1,6 @@
public class Main {
public static void main(String[] args) {
Fenetre fenetre = new Fenetre();
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,19 @@
import java.awt.*;
import javax.swing.*;
public class Six extends JComponent {
@Override
public void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
Image img = Toolkit.getDefaultToolkit().getImage("6.png");
// On place l'image au milieu de son composant puis on soustrait par la moitié des dimensions de l'image (55x80)
secondPinceau.drawImage(img, this.getWidth()/2 - 27 , this.getHeight()/2 - 40, this);
}
}