fin
This commit is contained in:
BIN
DEV2.1/Classe_objet/Journee.class
Normal file
BIN
DEV2.1/Classe_objet/Journee.class
Normal file
Binary file not shown.
11
DEV2.1/Classe_objet/Journee.java
Normal file
11
DEV2.1/Classe_objet/Journee.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import date.Date;
|
||||||
|
|
||||||
|
public class Journee {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Date mardi = new Date(args[0],args[1],args[2]);
|
||||||
|
Date mardi2 = new Date(args[0],args[1],args[2]);
|
||||||
|
System.out.println(mardi.toString());
|
||||||
|
System.out.println(mardi.Lendemain());
|
||||||
|
mardi.Meme(mardi2);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Classe_objet/Progression.class
Normal file
BIN
DEV2.1/Classe_objet/Progression.class
Normal file
Binary file not shown.
15
DEV2.1/Classe_objet/Progression.java
Normal file
15
DEV2.1/Classe_objet/Progression.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import compteur.Compteur;
|
||||||
|
|
||||||
|
public class Progression {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Compteur n = new Compteur();
|
||||||
|
for (int j = 0;j <= 5;j++)
|
||||||
|
n.plusUn();
|
||||||
|
for (int i = 5;i < 10;i++){
|
||||||
|
System.out.println(n.toString());
|
||||||
|
n.plusUn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Classe_objet/compteur/Compteur.class
Normal file
BIN
DEV2.1/Classe_objet/compteur/Compteur.class
Normal file
Binary file not shown.
16
DEV2.1/Classe_objet/compteur/Compteur.java
Normal file
16
DEV2.1/Classe_objet/compteur/Compteur.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package compteur;
|
||||||
|
public class Compteur {
|
||||||
|
// attribut
|
||||||
|
private int compte;
|
||||||
|
// méthode
|
||||||
|
public void plusUn() {
|
||||||
|
this.compte++;
|
||||||
|
}
|
||||||
|
public Compteur() {
|
||||||
|
this.compte = 0;
|
||||||
|
}
|
||||||
|
// autre méthode
|
||||||
|
public String toString() {
|
||||||
|
return Integer.toBinaryString(this.compte);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Classe_objet/date/Date.class
Normal file
BIN
DEV2.1/Classe_objet/date/Date.class
Normal file
Binary file not shown.
72
DEV2.1/Classe_objet/date/Date.java
Normal file
72
DEV2.1/Classe_objet/date/Date.java
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
package date;
|
||||||
|
public class Date {
|
||||||
|
private String jour;
|
||||||
|
private String mois;
|
||||||
|
private String annee;
|
||||||
|
|
||||||
|
public Date(String j, String m, String a) {
|
||||||
|
this.jour = j;
|
||||||
|
this.mois = m;
|
||||||
|
this.annee = a;
|
||||||
|
}
|
||||||
|
public void Meme(Date date2){
|
||||||
|
int error = 0;
|
||||||
|
if (this.jour != date2.jour)
|
||||||
|
error++;
|
||||||
|
else if (this.mois != date2.mois)
|
||||||
|
error++;
|
||||||
|
else if (this.annee != date2.annee)
|
||||||
|
error++;
|
||||||
|
if (error == 0)
|
||||||
|
System.out.println("C'est la même date");
|
||||||
|
else
|
||||||
|
System.out.println("Ce n'est pas la même date");
|
||||||
|
}
|
||||||
|
public String Lendemain(){
|
||||||
|
int an = Integer.parseInt(this.annee);
|
||||||
|
int mo = Integer.parseInt(this.mois);
|
||||||
|
int jo = Integer.parseInt(this.jour);
|
||||||
|
if (mo < 7){
|
||||||
|
if (mo % 2 == 1){
|
||||||
|
if (jo < 31){
|
||||||
|
jo++;
|
||||||
|
}else{
|
||||||
|
jo = 1;
|
||||||
|
mo++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (jo < 30){
|
||||||
|
jo++;
|
||||||
|
}else{
|
||||||
|
jo = 1;
|
||||||
|
mo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (mo % 2 == 0){
|
||||||
|
if (jo < 31){
|
||||||
|
jo++;
|
||||||
|
}else{
|
||||||
|
jo = 1;
|
||||||
|
if (mo == 12){
|
||||||
|
mo = 1;
|
||||||
|
an++;
|
||||||
|
}else{
|
||||||
|
mo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (jo < 30){
|
||||||
|
jo++;
|
||||||
|
}else{
|
||||||
|
jo = 1;
|
||||||
|
mo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return an+"-"+mo+"-"+jo;
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return this.annee+"-"+this.mois+"-"+this.jour;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/Forme.class
Normal file
BIN
DEV2.1/Dessin/Forme.class
Normal file
Binary file not shown.
22
DEV2.1/Dessin/Forme.java
Normal file
22
DEV2.1/Dessin/Forme.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import formegeo.*;
|
||||||
|
|
||||||
|
public class Forme extends JComponent{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(500, 300);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
GridLayout gestionnaire = new GridLayout(2, 2);
|
||||||
|
fenetre.setLayout(gestionnaire);
|
||||||
|
Carre carre = new Carre();
|
||||||
|
Disque disque = new Disque();
|
||||||
|
Texte texte = new Texte();
|
||||||
|
Tag tag = new Tag();
|
||||||
|
fenetre.add(carre);
|
||||||
|
fenetre.add(disque);
|
||||||
|
fenetre.add(texte);
|
||||||
|
fenetre.add(tag);
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/Sautoir.class
Normal file
BIN
DEV2.1/Dessin/Sautoir.class
Normal file
Binary file not shown.
19
DEV2.1/Dessin/Sautoir.java
Normal file
19
DEV2.1/Dessin/Sautoir.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import formesable.Sablier;
|
||||||
|
|
||||||
|
public class Sautoir {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(500, 500);
|
||||||
|
GridLayout gestionnaire = new GridLayout(5, 5);
|
||||||
|
gestionnaire.setVgap(-15);
|
||||||
|
fenetre.setLayout(gestionnaire);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
for (int i=0; i<25; i++){
|
||||||
|
Sablier sablier = new Sablier();
|
||||||
|
fenetre.add(sablier);
|
||||||
|
}
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/formegeo/Carre.class
Normal file
BIN
DEV2.1/Dessin/formegeo/Carre.class
Normal file
Binary file not shown.
13
DEV2.1/Dessin/formegeo/Carre.java
Normal file
13
DEV2.1/Dessin/formegeo/Carre.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package formegeo;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class Carre extends JComponent {
|
||||||
|
@Override
|
||||||
|
public void paintComponent(Graphics pinceau) {
|
||||||
|
Graphics secondPinceau = pinceau.create();
|
||||||
|
secondPinceau.setColor(Color.BLUE);
|
||||||
|
secondPinceau.drawRect(10,10,50, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/formegeo/Disque.class
Normal file
BIN
DEV2.1/Dessin/formegeo/Disque.class
Normal file
Binary file not shown.
13
DEV2.1/Dessin/formegeo/Disque.java
Normal file
13
DEV2.1/Dessin/formegeo/Disque.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package formegeo;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class Disque extends JComponent {
|
||||||
|
@Override
|
||||||
|
public void paintComponent(Graphics pinceau) {
|
||||||
|
Graphics secondPinceau = pinceau.create();
|
||||||
|
secondPinceau.setColor(Color.GREEN);
|
||||||
|
secondPinceau.fillOval(10,10,50, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/formegeo/Tag.class
Normal file
BIN
DEV2.1/Dessin/formegeo/Tag.class
Normal file
Binary file not shown.
21
DEV2.1/Dessin/formegeo/Tag.java
Normal file
21
DEV2.1/Dessin/formegeo/Tag.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package formegeo;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Tag extends JComponent {
|
||||||
|
private Image cercle;
|
||||||
|
public Tag() {
|
||||||
|
super();
|
||||||
|
this.cercle = Toolkit.getDefaultToolkit().getImage("formegeo/cercles.png");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void paintComponent(Graphics pinceau) {
|
||||||
|
Graphics secondPinceau = pinceau.create();
|
||||||
|
if (this.isOpaque()) {
|
||||||
|
secondPinceau.setColor(this.getBackground());
|
||||||
|
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
secondPinceau.drawImage(this.cercle, 10, 20, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/formegeo/Texte.class
Normal file
BIN
DEV2.1/Dessin/formegeo/Texte.class
Normal file
Binary file not shown.
17
DEV2.1/Dessin/formegeo/Texte.java
Normal file
17
DEV2.1/Dessin/formegeo/Texte.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package formegeo;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class Texte extends JComponent {
|
||||||
|
@Override
|
||||||
|
public 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(Color.MAGENTA);
|
||||||
|
secondPinceau.drawString(">o<", 10, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Dessin/formegeo/cercles.png
Normal file
BIN
DEV2.1/Dessin/formegeo/cercles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
DEV2.1/Dessin/formesable/Sablier.class
Normal file
BIN
DEV2.1/Dessin/formesable/Sablier.class
Normal file
Binary file not shown.
17
DEV2.1/Dessin/formesable/Sablier.java
Normal file
17
DEV2.1/Dessin/formesable/Sablier.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package formesable;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Color;
|
||||||
|
|
||||||
|
public class Sablier extends JComponent {
|
||||||
|
@Override
|
||||||
|
public void paintComponent(Graphics pinceau) {
|
||||||
|
Graphics secondPinceau = pinceau.create();
|
||||||
|
secondPinceau.setColor(Color.CYAN);
|
||||||
|
int[] x = null;
|
||||||
|
y = new int[] {90,0,0,90};
|
||||||
|
int[] y = null;
|
||||||
|
x = new int[] {100,0,100,0};
|
||||||
|
secondPinceau.fillPolygon(x,y,4);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Evenement/Attente$1.class
Normal file
BIN
DEV2.1/Evenement/Attente$1.class
Normal file
Binary file not shown.
BIN
DEV2.1/Evenement/Attente$2.class
Normal file
BIN
DEV2.1/Evenement/Attente$2.class
Normal file
Binary file not shown.
BIN
DEV2.1/Evenement/Attente.class
Normal file
BIN
DEV2.1/Evenement/Attente.class
Normal file
Binary file not shown.
69
DEV2.1/Evenement/Attente.java
Normal file
69
DEV2.1/Evenement/Attente.java
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
public class Attente extends JFrame {
|
||||||
|
private JPanel panel;
|
||||||
|
private boolean isInBackground = false;
|
||||||
|
|
||||||
|
public Attente() {
|
||||||
|
setTitle("Attente");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(300, 300);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
// Création du panneau
|
||||||
|
panel = new JPanel() {
|
||||||
|
@Override
|
||||||
|
protected void paintComponent(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
if (isInBackground) {
|
||||||
|
// Dessiner des triangles lorsque la fenêtre est en arrière-plan
|
||||||
|
dessinerTriangles(g);
|
||||||
|
} else {
|
||||||
|
// Dessiner un disque magenta lorsque la fenêtre est en premier plan
|
||||||
|
g.setColor(Color.MAGENTA);
|
||||||
|
int diametre = Math.min(getWidth(), getHeight()) - 50;
|
||||||
|
int x = (getWidth() - diametre) / 2;
|
||||||
|
int y = (getHeight() - diametre) / 2;
|
||||||
|
g.fillOval(x, y, diametre, diametre);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
panel.setBackground(Color.GREEN); // Définir la couleur de fond du panneau
|
||||||
|
|
||||||
|
// Ajouter le panneau à la fenêtre
|
||||||
|
add(panel);
|
||||||
|
|
||||||
|
// Ajouter un WindowListener pour détecter les événements de la fenêtre
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowActivated(WindowEvent e) {
|
||||||
|
isInBackground = false;
|
||||||
|
panel.repaint(); // Redessiner le panneau lorsque la fenêtre revient au premier plan
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowDeactivated(WindowEvent e) {
|
||||||
|
isInBackground = true;
|
||||||
|
panel.repaint(); // Redessiner le panneau lorsque la fenêtre passe en arrière-plan
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Méthode pour dessiner des triangles
|
||||||
|
private void dessinerTriangles(Graphics g) {
|
||||||
|
g.setColor(Color.BLACK);
|
||||||
|
int[] x = null;
|
||||||
|
x = new int[] {90,0,0,90};
|
||||||
|
int[] y = null;
|
||||||
|
y = new int[] {100,0,100,0};
|
||||||
|
g.fillPolygon(x,y,4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Attente();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Evenement/Fond.class
Normal file
BIN
DEV2.1/Evenement/Fond.class
Normal file
Binary file not shown.
59
DEV2.1/Evenement/Fond.java
Normal file
59
DEV2.1/Evenement/Fond.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
class Mypanel extends JPanel implements ActionListener {
|
||||||
|
|
||||||
|
public Mypanel(){
|
||||||
|
super();
|
||||||
|
// Création des boutons
|
||||||
|
JButton cyanButton = new JButton("Cyan");
|
||||||
|
JButton magentaButton = new JButton("Magenta");
|
||||||
|
JButton yellowButton = new JButton("Jaune");
|
||||||
|
|
||||||
|
// Ajout des action listeners aux boutons
|
||||||
|
cyanButton.addActionListener(this);
|
||||||
|
magentaButton.addActionListener(this);
|
||||||
|
yellowButton.addActionListener(this);
|
||||||
|
|
||||||
|
// Création du panneau pour contrôler la couleur de fond
|
||||||
|
this.add(cyanButton);
|
||||||
|
this.add(magentaButton);
|
||||||
|
this.add(yellowButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
String command = e.getActionCommand();
|
||||||
|
switch (command) {
|
||||||
|
case "Cyan":
|
||||||
|
this.setBackground(Color.CYAN);
|
||||||
|
break;
|
||||||
|
case "Magenta":
|
||||||
|
this.setBackground(Color.MAGENTA);
|
||||||
|
break;
|
||||||
|
case "Jaune":
|
||||||
|
this.setBackground(Color.YELLOW);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Fond{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(500, 500);
|
||||||
|
fenetre.setTitle("Changement de Fond");
|
||||||
|
fenetre.setLayout(new GridLayout(1, 1));
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
// Création du panneau pour contrôler la couleur de fond
|
||||||
|
JPanel panneau = new Mypanel();
|
||||||
|
|
||||||
|
fenetre.add(panneau);
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Evenement/Mypanel.class
Normal file
BIN
DEV2.1/Evenement/Mypanel.class
Normal file
Binary file not shown.
BIN
DEV2.1/Evenement/Radio.class
Normal file
BIN
DEV2.1/Evenement/Radio.class
Normal file
Binary file not shown.
64
DEV2.1/Evenement/Radio.java
Normal file
64
DEV2.1/Evenement/Radio.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
public class Radio extends JFrame implements ActionListener {
|
||||||
|
private JPanel panel;
|
||||||
|
private JRadioButton cyanButton, magentaButton, yellowButton;
|
||||||
|
|
||||||
|
public Radio() {
|
||||||
|
setTitle("Radio");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(300, 200);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
// Création du panneau
|
||||||
|
panel = new JPanel();
|
||||||
|
panel.setLayout(new FlowLayout());
|
||||||
|
|
||||||
|
// Création des boutons radio
|
||||||
|
cyanButton = new JRadioButton("Cyan");
|
||||||
|
magentaButton = new JRadioButton("Magenta");
|
||||||
|
yellowButton = new JRadioButton("Yellow");
|
||||||
|
|
||||||
|
// Ajout des boutons radio au panneau
|
||||||
|
panel.add(cyanButton);
|
||||||
|
panel.add(magentaButton);
|
||||||
|
panel.add(yellowButton);
|
||||||
|
|
||||||
|
// Ajout des boutons radio à un groupe de boutons pour permettre la sélection unique
|
||||||
|
ButtonGroup buttonGroup = new ButtonGroup();
|
||||||
|
buttonGroup.add(cyanButton);
|
||||||
|
buttonGroup.add(magentaButton);
|
||||||
|
buttonGroup.add(yellowButton);
|
||||||
|
|
||||||
|
// Ajout d'un écouteur d'événements aux boutons radio
|
||||||
|
cyanButton.addActionListener(this);
|
||||||
|
magentaButton.addActionListener(this);
|
||||||
|
yellowButton.addActionListener(this);
|
||||||
|
|
||||||
|
// Ajout du panneau à la fenêtre
|
||||||
|
add(panel);
|
||||||
|
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
Color color = null;
|
||||||
|
// Vérifier quel bouton radio est sélectionné et définir la couleur correspondante
|
||||||
|
if (e.getSource() == cyanButton) {
|
||||||
|
color = Color.CYAN;
|
||||||
|
} else if (e.getSource() == magentaButton) {
|
||||||
|
color = Color.MAGENTA;
|
||||||
|
} else if (e.getSource() == yellowButton) {
|
||||||
|
color = Color.YELLOW;
|
||||||
|
}
|
||||||
|
// Définir la couleur de fond du panneau
|
||||||
|
panel.setBackground(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Radio();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Evenement_suite/Mypanel.class
Normal file
BIN
DEV2.1/Evenement_suite/Mypanel.class
Normal file
Binary file not shown.
BIN
DEV2.1/Evenement_suite/Playlist.class
Normal file
BIN
DEV2.1/Evenement_suite/Playlist.class
Normal file
Binary file not shown.
61
DEV2.1/Evenement_suite/Playlist.java
Normal file
61
DEV2.1/Evenement_suite/Playlist.java
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.awt.Color.*;
|
||||||
|
|
||||||
|
public class Playlist extends JFrame implements MouseListener{
|
||||||
|
@Override
|
||||||
|
void mouseClicked(MouseEvent evenement){
|
||||||
|
evenement.setBackground(COLOR.GREY);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
void mouseEntered(MouseEvent evenement){
|
||||||
|
evenement.setBackground(COLOR.CYAN);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
void mouseExited(MouseEvent evenement){
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(300, 200);
|
||||||
|
fenetre.setTitle("Playlist");
|
||||||
|
GridLayout grid = new GridLayout(9, 1);
|
||||||
|
grid.setVgap(-15);
|
||||||
|
fenetre.setLayout(grid);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
JLabel mus1 = new JLabel("Speak To Me/Breathe");
|
||||||
|
JLabel mus2 = new JLabel("On The Run");
|
||||||
|
JLabel mus3 = new JLabel("Time");
|
||||||
|
JLabel mus4 = new JLabel("The Great Gig in The Sky");
|
||||||
|
JLabel mus5 = new JLabel("Money");
|
||||||
|
JLabel mus6 = new JLabel("Us And Them");
|
||||||
|
JLabel mus7 = new JLabel("Any Colour You Like");
|
||||||
|
JLabel mus8 = new JLabel("Brain Damage");
|
||||||
|
JLabel mus9 = new JLabel("Eclipse");
|
||||||
|
|
||||||
|
JLabel[] tab = null;
|
||||||
|
tab = new JLabel[] {mus1,mus2,mus3,mus4,mus5,mus6,mus7,mus8,mus9};
|
||||||
|
|
||||||
|
for (int i=0; i<9; i++){
|
||||||
|
mouseClicked(tab[i]);
|
||||||
|
mouseEntered(tab[i]);
|
||||||
|
mouseExited(tab[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fenetre.add(mus1);
|
||||||
|
fenetre.add(mus2);
|
||||||
|
fenetre.add(mus3);
|
||||||
|
fenetre.add(mus4);
|
||||||
|
fenetre.add(mus5);
|
||||||
|
fenetre.add(mus6);
|
||||||
|
fenetre.add(mus7);
|
||||||
|
fenetre.add(mus8);
|
||||||
|
fenetre.add(mus9);
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Evenement_suite/Volume.class
Normal file
BIN
DEV2.1/Evenement_suite/Volume.class
Normal file
Binary file not shown.
56
DEV2.1/Evenement_suite/Volume.java
Normal file
56
DEV2.1/Evenement_suite/Volume.java
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
public class Volume extends JFrame implements MouseWheelListener {
|
||||||
|
private int value = 5; // Valeur initiale
|
||||||
|
|
||||||
|
public Volume() {
|
||||||
|
setTitle("Volume");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(800, 200);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
getContentPane().setBackground(Color.BLACK); // Changement de la couleur de fond en noir
|
||||||
|
|
||||||
|
// Ajout de la molette de la souris comme écouteur d'événements
|
||||||
|
addMouseWheelListener(this);
|
||||||
|
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
super.paint(g);
|
||||||
|
int diameter = 50; // Diamètre des disques
|
||||||
|
int spacing = 10; // Espacement entre les disques
|
||||||
|
int x = 50; // Position horizontale initiale des disques
|
||||||
|
|
||||||
|
// Dessin des disques jaune
|
||||||
|
for (int i = 0; i < value; i++) {
|
||||||
|
g.setColor(Color.YELLOW);
|
||||||
|
g.fillOval(x, 75 - diameter / 2, diameter, diameter);
|
||||||
|
x += diameter + spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dessin des disques restant en gris
|
||||||
|
for (int i = value; i < 10; i++) {
|
||||||
|
g.setColor(Color.GRAY);
|
||||||
|
g.fillOval(x, 75 - diameter / 2, diameter, diameter);
|
||||||
|
x += diameter + spacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
|
// Ajustement de la valeur en fonction du mouvement de la molette de la souris
|
||||||
|
value += e.getWheelRotation();
|
||||||
|
// Assurer que la valeur reste dans la plage de 0 à 10
|
||||||
|
value = Math.max(0, Math.min(10, value));
|
||||||
|
// Redessiner la fenêtre pour afficher la nouvelle valeur
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Volume();
|
||||||
|
}
|
||||||
|
}
|
||||||
5
DEV2.1/Exception/ex1/ArithmeticException.java
Normal file
5
DEV2.1/Exception/ex1/ArithmeticException.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
public class ArithmeticException {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int result = 10 / 0; // Division par zéro
|
||||||
|
}
|
||||||
|
}
|
||||||
7
DEV2.1/Exception/ex1/ArrayIndexOutOfBoundsExample.java
Normal file
7
DEV2.1/Exception/ex1/ArrayIndexOutOfBoundsExample.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
public class ArrayIndexOutOfBoundsExample {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int[] array = new int[5];
|
||||||
|
System.out.println(array[10]); // Tentative d'accès à un index inexistant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BIN
DEV2.1/Heritage/Documentation.class
Normal file
BIN
DEV2.1/Heritage/Documentation.class
Normal file
Binary file not shown.
18
DEV2.1/Heritage/Documentation.java
Normal file
18
DEV2.1/Heritage/Documentation.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*La classe String vient du package java.lang et hérite de la classe
|
||||||
|
Object. Il y a 8 méthodes transmise de Object.*/
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Documentation {
|
||||||
|
public void Majuscule(String[] args) {
|
||||||
|
System.out.print(args[0].toUpperCase());
|
||||||
|
for (int i=1; i<args.length; i++){
|
||||||
|
System.out.print(" "+args[i].toUpperCase());
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
public void Base16(String[] args) {
|
||||||
|
int n=Integer.parseInt(args[0],8);
|
||||||
|
System.out.println(Integer.toHexString(n));
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Heritage/Grisaille.class
Normal file
BIN
DEV2.1/Heritage/Grisaille.class
Normal file
Binary file not shown.
20
DEV2.1/Heritage/Grisaille.java
Normal file
20
DEV2.1/Heritage/Grisaille.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import couleur.Gris;
|
||||||
|
|
||||||
|
public class Grisaille {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Color ton1 = new Gris(155);
|
||||||
|
Color ton2 = new Gris(75);
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(500, 300);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
JTextField etiquette = new JTextField();
|
||||||
|
JTextArea etiquette2 = new JTextArea();
|
||||||
|
etiquette.setBackground(ton1);
|
||||||
|
etiquette2.setBackground(ton2);
|
||||||
|
fenetre.add(etiquette, BorderLayout.SOUTH);
|
||||||
|
fenetre.add(etiquette2, BorderLayout.CENTER);
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
DEV2.1/Heritage/couleur/Gris.class
Normal file
BIN
DEV2.1/Heritage/couleur/Gris.class
Normal file
Binary file not shown.
9
DEV2.1/Heritage/couleur/Gris.java
Normal file
9
DEV2.1/Heritage/couleur/Gris.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package couleur;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Gris extends Color{
|
||||||
|
public Gris(int n) {
|
||||||
|
super(n,n,n);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
DEV2.1/Heritage/metrique/PaperM.java
Normal file
14
DEV2.1/Heritage/metrique/PaperM.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package metrique;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class PaperM extends Paper{
|
||||||
|
public PaperM() {
|
||||||
|
super();
|
||||||
|
this.setSize(21.0,29.7);
|
||||||
|
this.setImageableArea(21.0,29.7,19.5,28.2);
|
||||||
|
}
|
||||||
|
public getMetricHeight(){
|
||||||
|
}
|
||||||
|
/*a complété mais juste à faire des convertion*/
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -6,16 +6,19 @@ public class Damier {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Color blanc = new Color(255,255,255);
|
Color blanc = new Color(255,255,255);
|
||||||
Color cyan = new Color(0,255,255);
|
Color cyan = new Color(0,255,255);
|
||||||
Color tab[] = {blanc,cyan};
|
|
||||||
int l = Integer.parseInt(args[0]);
|
int l = Integer.parseInt(args[0]);
|
||||||
|
System.out.println(l);
|
||||||
JFrame fenetre = new JFrame();
|
JFrame fenetre = new JFrame();
|
||||||
fenetre.setSize(500, 300);
|
fenetre.setSize(500, 500);
|
||||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
GridLayout gestionnaire = new GridLayout(l, l);
|
GridLayout gestionnaire = new GridLayout(l, l);
|
||||||
fenetre.setLayout(gestionnaire);
|
fenetre.setLayout(gestionnaire);
|
||||||
JTextArea block = new JTextArea();
|
|
||||||
for (int i=0; i<(l*l); i++){
|
for (int i=0; i<(l*l); i++){
|
||||||
block.setBackground(tab[i%2]);
|
JTextField block = new JTextField(" ");
|
||||||
|
if (i % 2 == 0)
|
||||||
|
block.setBackground(blanc);
|
||||||
|
else
|
||||||
|
block.setBackground(cyan);
|
||||||
fenetre.add(block);
|
fenetre.add(block);
|
||||||
}
|
}
|
||||||
fenetre.setVisible(true);
|
fenetre.setVisible(true);
|
||||||
|
|||||||
BIN
DEV2.1/Mise_page/Question.class
Normal file
BIN
DEV2.1/Mise_page/Question.class
Normal file
Binary file not shown.
29
DEV2.1/Mise_page/Question.java
Normal file
29
DEV2.1/Mise_page/Question.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Question {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JFrame fenetre = new JFrame();
|
||||||
|
fenetre.setSize(500, 500);
|
||||||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
GridLayout gestionnaire = new GridLayout(3, 3);
|
||||||
|
fenetre.setLayout(gestionnaire);
|
||||||
|
JPanel panneau = new JPanel();
|
||||||
|
JLabel phrase = new JLabel("Aimez-vous les chiens ?");
|
||||||
|
phrase.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
phrase.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
|
JButton bouton = new JButton("Oui");
|
||||||
|
panneau.add(bouton);
|
||||||
|
JButton bouton1 = new JButton("Non");
|
||||||
|
panneau.add(bouton1);
|
||||||
|
JButton bouton2 = new JButton("NSPP");
|
||||||
|
panneau.add(bouton2);
|
||||||
|
for (int i = 0; i < 12; i++){
|
||||||
|
if (i == 5)
|
||||||
|
fenetre.add(phrase);
|
||||||
|
else if (i == 8)
|
||||||
|
fenetre.add(panneau);
|
||||||
|
}
|
||||||
|
fenetre.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user