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

View File

@@ -0,0 +1,19 @@
import java.awt.*;
import javax.swing.*;
public class Fenetre extends JFrame {
public Fenetre() {
this.setSize(300, 400);
this.setLocation(100, 100);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLayout(new GridLayout(1, 1));
JPanel fond = new JPanel();
fond.setBackground(Color.BLACK);
this.add(fond);
GestionMolette molette = new GestionMolette(fond);
this.addMouseWheelListener(molette);
}
}

View File

@@ -0,0 +1,21 @@
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class GestionMolette implements MouseWheelListener {
private JPanel fond;
public GestionMolette(JPanel fond) {
this.fond = fond;
}
public void mouseWheelMoved(MouseWheelEvent evenement) {
if (evenement.getWheelRotation() < 0) {
this.fond.setBackground(Color.WHITE);
}
else {
this.fond.setBackground(Color.BLACK);
}
}
}

View File

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