update
This commit is contained in:
22
DEV.2.1/CM1/ex1/Filtre.java
Normal file
22
DEV.2.1/CM1/ex1/Filtre.java
Normal file
@@ -0,0 +1,22 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
public class Filtre {
|
||||
|
||||
private String[] chaine;
|
||||
private String[] newChaine;
|
||||
|
||||
public Filtre(String[] chaine) {
|
||||
this.chaine = chaine;
|
||||
}
|
||||
|
||||
public String filtrage(String[] chaine) {
|
||||
for(int i = 0;i != this.chaine.length(); i++) {
|
||||
if(chaine[i].isLowerCase()) {
|
||||
this.newChaine += chaine[i];
|
||||
}
|
||||
}
|
||||
return this.newChaine;
|
||||
}
|
||||
|
||||
}
|
||||
|
13
DEV.2.1/CM1/ex1/FiltreII.java
Normal file
13
DEV.2.1/CM1/ex1/FiltreII.java
Normal file
@@ -0,0 +1,13 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
public class FiltreII {
|
||||
public static void main(String[] args) {
|
||||
for(int i = 0;i != args.length(); i++) {
|
||||
if(args[i].isLowerCase() || é || è || à || ù || ç){
|
||||
System.out.print(args[i]);
|
||||
}
|
||||
if (args[i].isWhitespace()) {
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
}
|
16
DEV.2.1/CM1/ex2/Excquis.java
Normal file
16
DEV.2.1/CM1/ex2/Excquis.java
Normal file
@@ -0,0 +1,16 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
public class Excquis {
|
||||
private String[] tab;
|
||||
|
||||
public Excquis(String[] tab) {
|
||||
this.tab = tab;
|
||||
}
|
||||
|
||||
public String toString(String[] randomTab) {
|
||||
indiceRandom = nextInt(this.tab.length());
|
||||
|
||||
for(this.tab[indiceRandom] :
|
||||
|
||||
}
|
||||
}
|
7
DEV.2.1/CM1/ex2/Main.java
Normal file
7
DEV.2.1/CM1/ex2/Main.java
Normal file
@@ -0,0 +1,7 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Excquis phraseI = new Excquis("John Mary Jack", "embrasse épouse tue", "chien voisin facteur", "le");
|
||||
}
|
||||
}
|
BIN
DEV.2.1/CM1/ex3/Compteurs.class
Normal file
BIN
DEV.2.1/CM1/ex3/Compteurs.class
Normal file
Binary file not shown.
27
DEV.2.1/CM1/ex3/Compteurs.java
Normal file
27
DEV.2.1/CM1/ex3/Compteurs.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Compteurs extends JComponent {
|
||||
|
||||
private Image img;
|
||||
|
||||
public Compteurs() {
|
||||
super();
|
||||
this.img = Toolkit.getDefaultToolkit().getImage("img.png");
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
secondPinceau.setColor(this.getForeground());
|
||||
|
||||
secondPinceau.drawImage(this.img, this.getWidth()/2, this.getHeight()/2, this);
|
||||
}
|
||||
}
|
BIN
DEV.2.1/CM1/ex3/Fenetre.class
Normal file
BIN
DEV.2.1/CM1/ex3/Fenetre.class
Normal file
Binary file not shown.
28
DEV.2.1/CM1/ex3/Fenetre.java
Normal file
28
DEV.2.1/CM1/ex3/Fenetre.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
public Fenetre() {
|
||||
super("Compteurs");
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setSize(500,500);
|
||||
this.setLocation(500,250);
|
||||
|
||||
Compteurs image6 = new Compteurs();
|
||||
this.add(image6);
|
||||
|
||||
JButton up = new JButton("up");
|
||||
up.setSize(50,50);
|
||||
up.setLocation(this.getWidth()/2, this.getHeight()/4);
|
||||
|
||||
JButton down = new JButton("down");
|
||||
down.setSize(50,50);
|
||||
down.setLocation(this.getWidth()/2, this.getHeight()*4);
|
||||
|
||||
this.add(up);
|
||||
this.add(down);
|
||||
|
||||
}
|
||||
}
|
BIN
DEV.2.1/CM1/ex3/Main.class
Normal file
BIN
DEV.2.1/CM1/ex3/Main.class
Normal file
Binary file not shown.
8
DEV.2.1/CM1/ex3/Main.java
Normal file
8
DEV.2.1/CM1/ex3/Main.java
Normal file
@@ -0,0 +1,8 @@
|
||||
/*Emmanuel SRIVASTAVA-TIAMZON*/
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
BIN
DEV.2.1/CM1/ex3/img.png
Normal file
BIN
DEV.2.1/CM1/ex3/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
47
DEV.2.1/CM1/ex4/Illumination.java
Normal file
47
DEV.2.1/CM1/ex4/Illumination.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
16
DEV.2.1/CM1/ex4/Mafenetre.java
Normal file
16
DEV.2.1/CM1/ex4/Mafenetre.java
Normal 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
10
DEV.2.1/CM1/ex4/Main.java
Normal 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);
|
||||
|
||||
}
|
||||
}
|
24
DEV.2.1/CM1/ex4/MouseWheel.java
Normal file
24
DEV.2.1/CM1/ex4/MouseWheel.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
DEV.2.1/CM1/srivasta_CM1.tar.gz
Normal file
BIN
DEV.2.1/CM1/srivasta_CM1.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user