Controle machine
This commit is contained in:
BIN
DEV2.1/CM1/04_Illumination/Fenetre.class
Normal file
BIN
DEV2.1/CM1/04_Illumination/Fenetre.class
Normal file
Binary file not shown.
19
DEV2.1/CM1/04_Illumination/Fenetre.java
Normal file
19
DEV2.1/CM1/04_Illumination/Fenetre.java
Normal 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);
|
||||
}
|
||||
}
|
BIN
DEV2.1/CM1/04_Illumination/GestionMolette.class
Normal file
BIN
DEV2.1/CM1/04_Illumination/GestionMolette.class
Normal file
Binary file not shown.
21
DEV2.1/CM1/04_Illumination/GestionMolette.java
Normal file
21
DEV2.1/CM1/04_Illumination/GestionMolette.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/CM1/04_Illumination/Main.class
Normal file
BIN
DEV2.1/CM1/04_Illumination/Main.class
Normal file
Binary file not shown.
6
DEV2.1/CM1/04_Illumination/Main.java
Normal file
6
DEV2.1/CM1/04_Illumination/Main.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user