27 Octobre

This commit is contained in:
Adrian POURCHOT 2023-10-27 14:58:17 +02:00
parent 87fa32a945
commit fae1f4c4c5
10 changed files with 22042 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,52 @@
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Luminance extends JPanel implements MouseListener{
public Luminance(){
super();
}
boolean listenoncréer = true;
protected void paintComponent(Graphics pinceau) {
// obligatoire : on cree un nouveau pinceau pour pouvoir le modifier plus tard
Graphics pinceau2 = pinceau.create();
List<Integer> paralleloliste = new ArrayList<>();
int color;
if (this.isOpaque()) {
// obligatoire : on repeint toute la surface avec la couleur de fond
pinceau2.setColor(Color.DARK_GRAY);
pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight());
} if(listenoncréer){
for (int i=0; i<30; i++){
Random rand = new Random();
color = rand.nextInt(256);
paralleloliste.add(i,color);
} listenoncréer = false;
} for (int i=0; i<10; i++){
int x[] = {0+(this.getWidth()/11)*i,80+(this.getWidth()/11)*i,180+(this.getWidth()/11)*i,100+(this.getWidth()/11)*i};
int y[] = {this.getHeight()-10,10,10,this.getHeight()-10};
pinceau2.setColor(new Color(paralleloliste.get(0+3*i),paralleloliste.get(1+3*i),paralleloliste.get(2+3*i)));
pinceau2.fillPolygon(x,y,4);
}
}
public void mouseClicked(MouseEvent e){
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
}

Binary file not shown.

View File

@ -0,0 +1,18 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class MainLuminance{
public static void main(String[] args) {
JFrame fenetre = new JFrame();
Luminance pan = new Luminance();
fenetre.setSize(1200, 250);
fenetre.setLocation(0, 0);
fenetre.addMouseListener(pan);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setContentPane(pan);
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@ -0,0 +1,31 @@
import java.util.*;
public class MainArithmetique {
public static String calculateur(String val, ArrayDeque<String> pile){
switch(val){
case "+":
return String.valueOf(Integer.parseInt(calculateur(pile.pop(), pile))+Integer.parseInt(calculateur(pile.pop(), pile)));
case "-":
return String.valueOf(-(Integer.parseInt(calculateur(pile.pop(), pile)))+Integer.parseInt(calculateur(pile.pop(), pile)));
case "x":
return String.valueOf(Integer.parseInt(calculateur(pile.pop(), pile))*Integer.parseInt(calculateur(pile.pop(), pile)));
case "/":
return String.valueOf(Integer.parseInt(calculateur(pile.pop(), pile))/Integer.parseInt(calculateur(pile.pop(), pile)));
default:
return val;
}
}
public static void main(String[] args) {
ArrayDeque<String> pile = new ArrayDeque(args.length);
String result;
for (int i=0; i<args.length; i++){
pile.push(args[i]);
}
result = calculateur(pile.pop(), pile);
System.out.println("\n = "+result);
}
}

9534
DEV3.4/TP2/Ex1TP2.mdj Normal file

File diff suppressed because it is too large Load Diff

2868
DEV3.4/TP2/Ex2TP2.mdj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
Le jardinier Papé14 visualise la division de la parcelle initiale de manière verticale.
Il visualise la partie gauche.
Il sélectionne la partie gauche.
Il la partage en 2 horizontalement.
Il change d'avis et réunit les 2 sous parcelles en une seule.

9534
Ex1TP2.mdj Normal file

File diff suppressed because it is too large Load Diff