Ajout des travaux effectuer
This commit is contained in:
BIN
23DEV1.1/TPS2/TP01/ClassesEtObjets/Compteur.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ClassesEtObjets/Compteur.class
Normal file
Binary file not shown.
21
23DEV1.1/TPS2/TP01/ClassesEtObjets/Compteur.java
Normal file
21
23DEV1.1/TPS2/TP01/ClassesEtObjets/Compteur.java
Normal file
@@ -0,0 +1,21 @@
|
||||
public class Compteur {
|
||||
|
||||
private int compte;
|
||||
|
||||
public void plusUn()
|
||||
{
|
||||
this.compte++;
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
return Integer.toBinaryString(this.compte);
|
||||
}
|
||||
public Compteur()
|
||||
{
|
||||
this.compte = 5;
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.out.println(toString());
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/ClassesEtObjets/Date.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ClassesEtObjets/Date.class
Normal file
Binary file not shown.
65
23DEV1.1/TPS2/TP01/ClassesEtObjets/Date.java
Normal file
65
23DEV1.1/TPS2/TP01/ClassesEtObjets/Date.java
Normal file
@@ -0,0 +1,65 @@
|
||||
public class Date {
|
||||
|
||||
private int year;
|
||||
private int month;
|
||||
private int day;
|
||||
|
||||
public String toString()
|
||||
{
|
||||
String Date = String.format("%04d-%02d-%02d", this.year, this.month, this.day);
|
||||
return Date;
|
||||
}
|
||||
public void Lendemain()
|
||||
{
|
||||
if(this.month == 1 || this.month == 3 || this.month == 5 || this.month == 7 || this.month == 8 || this.month == 10)
|
||||
{
|
||||
if(this.day == 31)
|
||||
{
|
||||
this.day = 1;
|
||||
this.month++;
|
||||
}
|
||||
}
|
||||
if(this.month == 2)
|
||||
{
|
||||
if(this.day == 28)
|
||||
{
|
||||
this.day = 1;
|
||||
this.month++;
|
||||
}
|
||||
}
|
||||
if(this.month == 4 || this.month == 6 || this.month == 9 || this.month == 11)
|
||||
{
|
||||
if(this.day == 30)
|
||||
{
|
||||
this.day = 1;
|
||||
this.month++;
|
||||
}
|
||||
}
|
||||
if(this.month == 12)
|
||||
{
|
||||
if(this.day == 31)
|
||||
{
|
||||
this.day = 1;
|
||||
this.month = 1;
|
||||
this.year++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.day++;
|
||||
}
|
||||
}
|
||||
public Date()
|
||||
{
|
||||
this.year = 2024;
|
||||
this.month = 02;
|
||||
this.day = 6;
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Date c = new Date();
|
||||
System.out.println(c);
|
||||
c.Lendemain();
|
||||
System.out.println(c);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Boutons.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Boutons.class
Normal file
Binary file not shown.
25
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Boutons.java
Normal file
25
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Boutons.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Boutons {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1040, 1000);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
/*JButton b1 = new JButton("One");
|
||||
JButton b2 = new JButton("Two");
|
||||
JButton b3 = new JButton("Three");
|
||||
JButton b4 = new JButton("Four");
|
||||
JButton b5 = new JButton("Five");
|
||||
fenetre.add(b1, BorderLayout.CENTER);
|
||||
fenetre.add(b2, BorderLayout.CENTER);
|
||||
fenetre.add(b3, BorderLayout.CENTER);
|
||||
fenetre.add(b4, BorderLayout.CENTER);
|
||||
fenetre.add(b5, BorderLayout.CENTER);*/
|
||||
JLabel etiquette = new JLabel("Hola quetale ! No abla espagnol!dlfihqsuio rgynklrgh,ektuctucçfiehsgfeuc(ruzertxetjerh,fhfzgfe,rftgekgfkey,rdf,dg,fgzeuy");
|
||||
etiquette.setHorizontalAlignment(JLabel.CENTER);
|
||||
fenetre.add(etiquette, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Choix.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Choix.class
Normal file
Binary file not shown.
18
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Choix.java
Normal file
18
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Choix.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Choix {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1040, 1000);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JRadioButton gri = new JRadioButton("Gryffondor");
|
||||
JRadioButton ser = new JRadioButton("Serpentard");
|
||||
JRadioButton serd = new JRadioButton("Serdaigle");
|
||||
fenetre.add(gri, BorderLayout.NORTH);
|
||||
fenetre.add(ser, BorderLayout.CENTER);
|
||||
fenetre.add(serd, BorderLayout.SOUTH);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Saisie.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Saisie.class
Normal file
Binary file not shown.
20
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Saisie.java
Normal file
20
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Saisie.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Saisie {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1040, 1000);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
JTextField f = new JTextField("LOL");
|
||||
f.setBackground(new Color(192, 192, 192));
|
||||
f.setForeground(new Color(0, 255, 0));
|
||||
JTextArea area = new JTextArea("CHEH");
|
||||
area.setBackground(new Color(0, 0, 0));
|
||||
area.setForeground(new Color(0, 255, 0));
|
||||
fenetre.add(f, BorderLayout.SOUTH);
|
||||
fenetre.add(area, BorderLayout.CENTER);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Sirocco.class
Normal file
BIN
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Sirocco.class
Normal file
Binary file not shown.
21
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Sirocco.java
Normal file
21
23DEV1.1/TPS2/TP01/ComposantsGraphiques/Sirocco.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Sirocco {
|
||||
public static void main(String[] args) {
|
||||
// un objet pour servir de fenetre
|
||||
JFrame fenetre = new JFrame();
|
||||
// on configure la fenetre
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
// un composant pour afficher du texte
|
||||
JLabel etiquette = new JLabel("Sirocco");
|
||||
// on configure l'etiquette
|
||||
etiquette.setHorizontalAlignment(JLabel.RIGHT);
|
||||
// on ajoute le composant dans la fenetre, au milieu
|
||||
fenetre.add(etiquette, BorderLayout.SOUTH);
|
||||
// et on montre le resultat
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
15527
23DEV1.1/TPS2/TP01/DCUetDC/TP.mdj
Normal file
15527
23DEV1.1/TPS2/TP01/DCUetDC/TP.mdj
Normal file
File diff suppressed because it is too large
Load Diff
31
23DEV1.1/TPS2/TP01/Dessin/Formes/Formes.java
Normal file
31
23DEV1.1/TPS2/TP01/Dessin/Formes/Formes.java
Normal file
@@ -0,0 +1,31 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.*;
|
||||
|
||||
public class Formes
|
||||
{
|
||||
private Image trucChelou;
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics secondPinceau = g.create();
|
||||
if(isOpaque())
|
||||
{
|
||||
secondPinceau.setColor(getBackground());
|
||||
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
secondPinceau.setColor(color.BLUE);
|
||||
fillRect(10, 10, 50, 50);
|
||||
secondPinceau.setColor(color.GREEN);
|
||||
drawOval(30,30, 25, 25);
|
||||
secondPinceau.setColor(color.MAGENTA);
|
||||
secondPinceau.drawString(">o<",getWidth()/2 - 30, getHeight()/2);
|
||||
secondPinceau.("cercles.png", );
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame frame = new JFrame("Frame");
|
||||
frame.setSize(400, 400);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Dessin/Formes/cercles.png
Normal file
BIN
23DEV1.1/TPS2/TP01/Dessin/Formes/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
22
23DEV1.1/TPS2/TP01/Dessin/sautoir.java
Normal file
22
23DEV1.1/TPS2/TP01/Dessin/sautoir.java
Normal file
@@ -0,0 +1,22 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class sautoir
|
||||
{
|
||||
@Override
|
||||
protected void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics pinceau = g.create();
|
||||
if(isOpaque())
|
||||
{
|
||||
pinceau.setColor(getBackground());
|
||||
pinceau.fillRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
pinceau.setColor(Color.CYAN);
|
||||
int[] triangleXPoints = {0, getWidth()/2, getWidth()};
|
||||
int[] topTriangleXPoints = {0, getHeight()/2, 0};
|
||||
pinceau.fillPolygon(triangleXPoints, topTriangleXPoints, 3);
|
||||
int[] bottomTriangleXPoints = {getHeight(), getHeight()/2, getHeight()};
|
||||
pinceau.fillPolygon(triangleXPoints, bottomTriangleXPoints, 3);
|
||||
}
|
||||
}
|
||||
6670
23DEV1.1/TPS2/TP01/DiagrammesDeSequence/TP.mdj
Normal file
6670
23DEV1.1/TPS2/TP01/DiagrammesDeSequence/TP.mdj
Normal file
File diff suppressed because it is too large
Load Diff
BIN
23DEV1.1/TPS2/TP01/Evènements/AttTest.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/AttTest.class
Normal file
Binary file not shown.
17
23DEV1.1/TPS2/TP01/Evènements/AttTest.java
Normal file
17
23DEV1.1/TPS2/TP01/Evènements/AttTest.java
Normal file
@@ -0,0 +1,17 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class AttTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(400, 400);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
Attente att = new Attente();
|
||||
fenetre.add(att);
|
||||
fenetre.addWindowListener(att);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Attente.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Attente.class
Normal file
Binary file not shown.
53
23DEV1.1/TPS2/TP01/Evènements/Attente.java
Normal file
53
23DEV1.1/TPS2/TP01/Evènements/Attente.java
Normal file
@@ -0,0 +1,53 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Attente extends JComponent implements WindowListener
|
||||
{
|
||||
boolean plan = true;
|
||||
protected void paintComponent(Graphics g)
|
||||
{
|
||||
Graphics secondPinceau = g.create();
|
||||
if (this.isOpaque()){
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
secondPinceau.setColor(Color.GREEN);
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
if (plan == true){
|
||||
secondPinceau.setColor(Color.RED);
|
||||
secondPinceau.fillOval(100, 90, 200, 200);
|
||||
}
|
||||
if (plan == false){
|
||||
secondPinceau.setColor(Color.CYAN);
|
||||
Polygon poly1 = new Polygon();
|
||||
poly1.addPoint(0,0);
|
||||
poly1.addPoint(this.getWidth(), 0);
|
||||
poly1.addPoint(this.getWidth()/2, this.getHeight()/2);
|
||||
secondPinceau.fillPolygon(poly1);
|
||||
Polygon poly2 = new Polygon();
|
||||
poly2.addPoint(this.getWidth()/2, this.getHeight()/2);
|
||||
poly2.addPoint(0, this.getHeight());
|
||||
poly2.addPoint(this.getWidth(), this.getHeight());
|
||||
secondPinceau.fillPolygon(poly2);
|
||||
}
|
||||
}
|
||||
public void windowActivated(WindowEvent evenement)
|
||||
{
|
||||
plan = true;
|
||||
this.repaint();
|
||||
}
|
||||
public void windowClosed(WindowEvent evenement){}
|
||||
public void windowClosing(WindowEvent evenement){}
|
||||
public void windowDeactivated(WindowEvent evenement)
|
||||
{
|
||||
plan = false;
|
||||
this.repaint();
|
||||
}
|
||||
public void windowDeiconified(WindowEvent evenement){}
|
||||
public void windowIconified(WindowEvent evenement){}
|
||||
public void windowOpened(WindowEvent evenement){}
|
||||
public Attente(){
|
||||
super();
|
||||
}
|
||||
}
|
||||
35
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Playlist.java
Normal file
35
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Playlist.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
|
||||
public class Playlist extends JComponent implements MouseWheelListener
|
||||
{
|
||||
int n = 0;
|
||||
int x = 70;
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque()) {
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.drawRect(0, 0, getWidth(), getHeight());
|
||||
}
|
||||
for(int i = 0 ; i <10 ; i++)
|
||||
{
|
||||
secondPinceau.setColor(Color.GRAY);
|
||||
secondPinceau.fillOval(x+10, 130, 70, 70);
|
||||
x = x+90;
|
||||
}
|
||||
for(int i = 0 ; i <n ; i++)
|
||||
{
|
||||
secondPinceau.setColor(Color.YELLOW);
|
||||
secondPinceau.fillOval(x+10, 130, 70, 70);
|
||||
x = x+90;
|
||||
}
|
||||
}
|
||||
public Playlist(){
|
||||
super();
|
||||
}
|
||||
}
|
||||
18
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestPlaylist.java
Normal file
18
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestPlaylist.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class TestPlaylist
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1000, 300);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setBackground(Color.GREY);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
Playlist p = new Playlist();
|
||||
|
||||
p.add();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/Evènement2/TestVolume.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class TestVolume
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(1000, 300);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(new Volume());
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.class
Normal file
Binary file not shown.
44
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.java
Normal file
44
23DEV1.1/TPS2/TP01/Evènements/Evènement2/Volume.java
Normal file
@@ -0,0 +1,44 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
|
||||
public class Volume extends JComponent implements MouseWheelListener
|
||||
{
|
||||
int x = 0;
|
||||
int nbrClic = 0;
|
||||
protected void paintComponent(Graphics pinceau)
|
||||
{
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
secondPinceau.setColor(Color.DARK_GRAY);
|
||||
secondPinceau.fillRect(0,0,this.getWidth(), this.getHeight());
|
||||
for(int i = 0 ; i < 10 ; i++)
|
||||
{
|
||||
secondPinceau.setColor(Color.GRAY);
|
||||
secondPinceau.fillOval(x, 50, 70, 70);
|
||||
x = x+60;
|
||||
}
|
||||
for(int i = 0 ; i < this.nbrClic ; i++)
|
||||
{
|
||||
secondPinceau.setColor(Color.YELLOW);
|
||||
secondPinceau.fillOval(x, 50, 70, 70);
|
||||
x = x+60;
|
||||
}
|
||||
}
|
||||
public void mouseWheelMoved(MouseWheelEvent evenement)
|
||||
{
|
||||
this.nbrClic = evenement.getWheelRotation();
|
||||
this.repaint();
|
||||
if(this.nbrClic>=10){
|
||||
nbrClic++;
|
||||
}
|
||||
if(this.nbrClic<=0){
|
||||
nbrClic--;
|
||||
}
|
||||
}
|
||||
public Volume(){
|
||||
super();
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Fond.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Fond.class
Normal file
Binary file not shown.
38
23DEV1.1/TPS2/TP01/Evènements/Fond.java
Normal file
38
23DEV1.1/TPS2/TP01/Evènements/Fond.java
Normal file
@@ -0,0 +1,38 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Fond extends JPanel implements ActionListener
|
||||
{
|
||||
public Fond()
|
||||
{
|
||||
super();
|
||||
JButton cyan = new JButton("Cyan");
|
||||
JButton magenta = new JButton("Magenta");
|
||||
JButton jaune = new JButton("Jaune");
|
||||
this.add(cyan);
|
||||
this.add(magenta);
|
||||
this.add(jaune);
|
||||
cyan.addActionListener(this);
|
||||
magenta.addActionListener(this);
|
||||
jaune.addActionListener(this);
|
||||
}
|
||||
public void actionPerformed(ActionEvent evenement)
|
||||
{
|
||||
String test;
|
||||
test = evenement.getActionCommand();
|
||||
if(test.equals("Cyan"))
|
||||
{
|
||||
this.setBackground(Color.CYAN);
|
||||
}
|
||||
if(test.equals("Magenta"))
|
||||
{
|
||||
this.setBackground(Color.MAGENTA);
|
||||
}
|
||||
if(test.equals("Jaune"))
|
||||
{
|
||||
this.setBackground(Color.YELLOW);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/RadTest.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/RadTest.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/RadTest.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/RadTest.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class RadTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(200, 200);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(new Radio());
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Radio.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Radio.class
Normal file
Binary file not shown.
37
23DEV1.1/TPS2/TP01/Evènements/Radio.java
Normal file
37
23DEV1.1/TPS2/TP01/Evènements/Radio.java
Normal file
@@ -0,0 +1,37 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Radio extends JPanel implements ActionListener
|
||||
{
|
||||
public Radio()
|
||||
{
|
||||
super();
|
||||
JRadioButton cyan = new JRadioButton("Cyan");
|
||||
JRadioButton magenta = new JRadioButton("Magenta");
|
||||
JRadioButton jaune = new JRadioButton("Jaune");
|
||||
this.add(cyan);
|
||||
this.add(magenta);
|
||||
this.add(jaune);
|
||||
cyan.addActionListener(this);
|
||||
magenta.addActionListener(this);
|
||||
jaune.addActionListener(this);
|
||||
}
|
||||
public void actionPerformed(ActionEvent evenement)
|
||||
{
|
||||
String test;
|
||||
test = evenement.getActionCommand();
|
||||
if(test.equals("Cyan"))
|
||||
{
|
||||
this.setBackground(Color.CYAN);
|
||||
}
|
||||
if(test.equals("Magenta"))
|
||||
{
|
||||
this.setBackground(Color.MAGENTA);
|
||||
}
|
||||
if(test.equals("Jaune"))
|
||||
{
|
||||
this.setBackground(Color.YELLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Evènements/Test.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Evènements/Test.class
Normal file
Binary file not shown.
15
23DEV1.1/TPS2/TP01/Evènements/Test.java
Normal file
15
23DEV1.1/TPS2/TP01/Evènements/Test.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(200, 200);
|
||||
fenetre.setLocation(100, 100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(new Fond());
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
20
23DEV1.1/TPS2/TP01/Exception/Capture/Capture.java
Normal file
20
23DEV1.1/TPS2/TP01/Exception/Capture/Capture.java
Normal file
@@ -0,0 +1,20 @@
|
||||
public class Capture
|
||||
{
|
||||
public int CalculTest(int a)
|
||||
{
|
||||
int res = a / 0;
|
||||
return res;
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
int arf = 15;
|
||||
System.out.println(CalculTest(arf));
|
||||
}
|
||||
catch(ArithmeticException ae)
|
||||
{
|
||||
System.out.println(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
6
23DEV1.1/TPS2/TP01/Exception/Incomplet/Incomplet.java
Normal file
6
23DEV1.1/TPS2/TP01/Exception/Incomplet/Incomplet.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Incomplet {
|
||||
public static void main(String[] args) {
|
||||
byte[] txt = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x0D, 0x0A};
|
||||
System.out.write(txt);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test1.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test1.class
Normal file
Binary file not shown.
10
23DEV1.1/TPS2/TP01/Exception/Plantages/Test1.java
Normal file
10
23DEV1.1/TPS2/TP01/Exception/Plantages/Test1.java
Normal file
@@ -0,0 +1,10 @@
|
||||
public class Test1
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int[] tab = {0,1,2,3,4,5,6,7,8,9};
|
||||
int i = 11;
|
||||
int res = tab[i];
|
||||
System.out.println(res);
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test2.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test2.class
Normal file
Binary file not shown.
8
23DEV1.1/TPS2/TP01/Exception/Plantages/Test2.java
Normal file
8
23DEV1.1/TPS2/TP01/Exception/Plantages/Test2.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Test2
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Object res = null;
|
||||
System.out.println(res.toString());
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test3.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test3.class
Normal file
Binary file not shown.
9
23DEV1.1/TPS2/TP01/Exception/Plantages/Test3.java
Normal file
9
23DEV1.1/TPS2/TP01/Exception/Plantages/Test3.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Test3
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
String i = "ahahahahahahah";
|
||||
int res = Integer.parseInt(i);
|
||||
System.out.println(res);
|
||||
}
|
||||
}
|
||||
16
23DEV1.1/TPS2/TP01/Exception/Plantages/Test4.java
Normal file
16
23DEV1.1/TPS2/TP01/Exception/Plantages/Test4.java
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
public class Test4
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
int res;
|
||||
System.out.println(res);
|
||||
}
|
||||
catch(RuntimeException re)
|
||||
{
|
||||
System.out.println(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test5.class
Normal file
BIN
23DEV1.1/TPS2/TP01/Exception/Plantages/Test5.class
Normal file
Binary file not shown.
8
23DEV1.1/TPS2/TP01/Exception/Plantages/Test5.java
Normal file
8
23DEV1.1/TPS2/TP01/Exception/Plantages/Test5.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Test5
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int res = 15 / 0;
|
||||
System.out.println(res);
|
||||
}
|
||||
}
|
||||
71
23DEV1.1/TPS2/TP01/FluxDOctet/Image/TestImage.java
Normal file
71
23DEV1.1/TPS2/TP01/FluxDOctet/Image/TestImage.java
Normal file
@@ -0,0 +1,71 @@
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestImage extends JPanel
|
||||
{
|
||||
private static final int WIDTH = 768;
|
||||
private static final int HEIGHT = 1024;
|
||||
private static final String FILE_PATH = "image.bin";
|
||||
|
||||
private BufferedImage image;
|
||||
|
||||
public TestImage()
|
||||
{
|
||||
try
|
||||
{
|
||||
loadImage();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void loadImage() throws IOException
|
||||
{
|
||||
FileInputStream fileInputStream = new FileInputStream(FILE_PATH);
|
||||
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
|
||||
byte[] imageData = new byte[WIDTH * HEIGHT * 3];
|
||||
// Lecture des données de l'image
|
||||
dataInputStream.readFully(imageData);
|
||||
dataInputStream.close();
|
||||
// Création d'une BufferedImage
|
||||
image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
|
||||
// Remplissage de l'image à partir des données lues
|
||||
int index = 0; for (int y = 0; y < HEIGHT; y++)
|
||||
{
|
||||
for (int x = 0; x < WIDTH; x++)
|
||||
{
|
||||
int r = imageData[index++] & 0xFF;
|
||||
// Rouge
|
||||
int g = imageData[index++] & 0xFF;
|
||||
// Vert
|
||||
int b = imageData[index++] & 0xFF;
|
||||
// Bleu
|
||||
int rgb = (r << 16) | (g << 8) | b;
|
||||
image.setRGB(x, y, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void paintComponent(Graphics g)
|
||||
{
|
||||
super.paintComponent(g);
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JFrame frame = new JFrame("Image Display");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.getContentPane().add(new ImageDisplay());
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
BIN
23DEV1.1/TPS2/TP01/FluxDOctet/Image/image.bin
Normal file
BIN
23DEV1.1/TPS2/TP01/FluxDOctet/Image/image.bin
Normal file
Binary file not shown.
BIN
23DEV1.1/TPS2/TP01/FluxDOctet/Mémoire/Fond.class
Normal file
BIN
23DEV1.1/TPS2/TP01/FluxDOctet/Mémoire/Fond.class
Normal file
Binary file not shown.
30
23DEV1.1/TPS2/TP01/FluxDOctet/Mémoire/Fond.java
Normal file
30
23DEV1.1/TPS2/TP01/FluxDOctet/Mémoire/Fond.java
Normal file
@@ -0,0 +1,30 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class Fond extends JPanel implements ActionListener
|
||||
{
|
||||
public Fond(){
|
||||
super();
|
||||
JButton cyan = new JButton("Cyan");
|
||||
JButton magenta = new JButton("Magenta");
|
||||
JButton jaune = new JButton("Jaune");
|
||||
this.add(cyan);
|
||||
this.add(magenta);
|
||||
this.add(jaune);
|
||||
cyan.addActionListener(this);
|
||||
magenta.addActionListener(this);
|
||||
jaune.addActionListener(this);
|
||||
}
|
||||
public void actionPerformed(ActionEvent evenement){
|
||||
String test;
|
||||
test = evenement.getActionCommand();
|
||||
if(test.equals("Cyan")){
|
||||
this.setBackground(Color.CYAN);
|
||||
}if(test.equals("Magenta")){
|
||||
this.setBackground(Color.MAGENTA);
|
||||
}if(test.equals("Jaune")){
|
||||
this.setBackground(Color.YELLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user