This commit is contained in:
EmmanuelTiamzon
2025-09-30 09:43:41 +02:00
parent f7de13bc2a
commit 7019a3b7ea
176 changed files with 9458 additions and 149 deletions

View File

@@ -0,0 +1,47 @@
/*Emmanuel SRIVASTAVA-TIAMZON*/
import javax.swing.*;
import java.awt.*;
public class Illumination extends JComponent {
private int niveau;
private JPanel panel;
public Illumination(int niveau) {
super();
this.niveau = niveau;
}
public int setNiveau(int newNiveau) {
if (newNiveau < 0) {
this.niveau = 0;
} else if (newNiveau > 10) {
this.niveau = 10;
} else {
this.niveau = newNiveau;
}
repaint();
}
public int getNiveau() {
return this.niveau;
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
if (this.isOpaque()){
secondPinceau.setColor(this.getBackground);
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
}
this.panel.setBackground(Color.BLACK);
if(this.niveau >= 0) {
this.panel.setBackground(Color.WHITE);
} else {
this.panel.setBackground(Color.BLACK);
}
}
}

View File

@@ -0,0 +1,16 @@
import javax.swing.*;
import java.awt.*;
public class Mafenetre extends JFrame {
public Mafenetre() {
super("Illumination");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(697,156);
this.setLocation(500,250);
Illumination illumination = new Illumination(5);
this.add(illumination);
}
}

10
DEV.2.1/CM1/ex4/Main.java Normal file
View File

@@ -0,0 +1,10 @@
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) {
Mafenetre fenetre = new Mafenetre();
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,24 @@
/*Emmanuel SRIVASTAVA-TIAMZON*/
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class MouseWheel implements MouseWheelListener {
public MouseWheel() {
super();
}
@Override
public void mouseWheelMoved(MouseWheelEvent evenement) {
if(evenement.getWheelRotation() < 0) {
this.newNiveau(evenement);
}else {
this.newNiveau(evenement);
}
}
}