This commit is contained in:
2023-10-23 13:23:36 +02:00
parent 667dae6f1a
commit 322b22f9bf
5711 changed files with 72953 additions and 0 deletions

View File

Binary file not shown.

View File

@@ -0,0 +1,31 @@
import javax.swing.JComponent;
import java.awt.*;
public class Dessin extends JComponent {
public Dessin(){
}
@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(Color.BLUE);
secondPinceau.drawRect(20,20, 50, 50);
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillOval(80, 20, 50, 50);
secondPinceau.setColor(Color.MAGENTA);
Font myFont = new Font("Arial", Font.BOLD, 14);
secondPinceau.setFont(myFont);
secondPinceau.drawString(">o<",140, 20);
Image cercles = Toolkit.getDefaultToolkit().getImage("cercles.png");
secondPinceau.drawImage(cercles,200,20,this);
}
}

View File

@@ -0,0 +1,22 @@
import javax.swing.JComponent;
import java.awt.Graphics;
public class Bonjour extends JComponent {
@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(new Color.BLUE);
secondPinceau.drawRect(20,20, 50, 50);
secondPinceau.setColor(new Color.GREEN);
secondPinceau.fillOval(80, 20, 50, 50);
secondPinceau.setColor(new Color.BLACK);
secondPinceau.drawString(140, 20, 50, 50)
}
}

Binary file not shown.

View File

@@ -0,0 +1,16 @@
import javax.swing.*;
import java.awt.*;
public class Q1_Formes{
public static void main(String[] args){
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dessin lesDessins = new Dessin();
fenetre.add(lesDessins);
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,19 @@
import javax.swing.*;
import java.awt.*;
public class Q1_Formes{
public static void main(String[] args){
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setVisible(true);
JPanel carre = new JPanel();
JPanel disque = new JPanel();
JPanel texte = new JPanel();
}
@Override
protected void paintComponent(Graphics pinceau)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

View File

@@ -0,0 +1,23 @@
import javax.swing.*;
import java.awt.*;
public class Q2Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame("Sautoir");
fenetre.setLocation(100, 100);
fenetre.setSize(288,215);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout grille = new GridLayout(Sablier.nbLigne, Sablier.nbColone);
fenetre.setLayout(grille);
Sablier[][] listeSablier = new Sablier[Sablier.nbLigne][Sablier.nbColone];
for (int y=0; y<Sablier.nbLigne; y++){
for (int x=0; x<Sablier.nbColone; x++){
listeSablier[y][x] = new Sablier();
fenetre.add(listeSablier[y][x]);
}
}
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,13 @@
import javax.swing.*;
import java.awt.*;
public class Q2Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame("Sautoir");
fenetre.setLocation(100, 100);
fenetre.setSize(288,215);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setContentPane(contenus);
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,30 @@
import javax.swing.*;
import java.awt.*;
public class Sablier extends JComponent {
public static int nbColone = 5;
public static int nbLigne = 5;
public Sablier() {
super();
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
int longueur = this.getWidth();
int hauteur = this.getHeight();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, longueur, hauteur);
}
int[] triangleXHaut = {0, longueur, longueur/2};
int[] triangleYHaut = {0, 0, hauteur/2};
int[] triangleXBas = {0, longueur, longueur/2};
int[] triangleYBas = {hauteur, hauteur, hauteur/2};
secondPinceau.setColor(new Color(255,100,0));
secondPinceau.fillPolygon(triangleXHaut, triangleYHaut, 3);
secondPinceau.fillPolygon(triangleXBas, triangleYBas, 3);
}
}

View File

@@ -0,0 +1,36 @@
import javax.swing.*;
import java.awt.*;
public class AfficheImage extends JComponent {
public int numColone;
public int numLigne;
public static int nbColone = 5;
public static int nbLigne = 5;
public AfficheImage(int numColone, int numLigne) {
super();
this.numColone = numColone;
this.numLigne = numLigne;
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
int longueur = this.getWidth();
int hauteur = this.getHeight();
if (this.isOpaque()) {
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, longueur, hauteur);
}
int uniteX = longueur/this.nbColone;
int uniteY = hauteur/this.nbLigne;
int[] triangleXHaut = {this.numColone*UniteX , (this.numColone+1)*UniteX , this.numColone*UniteX+UniteX/2};
int[] triangleYHaut = {};
int[] triangleXBas = {this.numColone*UniteX , (this.numColone+1)*UniteX , this.numColone*UniteX+UniteX/2};
int[] triangleYBas = {};
secondPinceau.setColor(new Color(255,100,0));
secondPinceau.fillPolygon(triangleXHaut, triangleYHaut, 3);
secondPinceau.fillPolygon(triangleXBas, triangleYBas, 3);
}
}

Binary file not shown.

View File

@@ -0,0 +1,40 @@
import javax.swing.JComponent;
import java.awt.*;
import javax.swing.*;
public class Accueil extends JComponent {
private Image acc;
public Accueil() {
super();
this.acc = Toolkit.getDefaultToolkit().getImage("login.jpg");
}
@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.drawImage(this.acc,0,0,this);
}
public static void main(String[] args) {
JFrame fenetre = new JFrame();
Accueil imag = new Accueil();
JTextField champlog = new JTextField();
JTextField champmdp = new JTextField();
fenetre.setLayout(null);
fenetre.setSize(290,220);
fenetre.setLocation(0,0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
imag.setLocation(0,0);
imag.setSize(278,183);
champlog.setSize(160,20);
champlog.setLocation(102,92);
champmdp.setSize(160,20);
champmdp.setLocation(102,134);
fenetre.add(imag);
fenetre.add(champlog);
fenetre.add(champmdp);
fenetre.setVisible(true);
}
}

Binary file not shown.

View File

@@ -0,0 +1,21 @@
import javax.swing.*;
import java.awt.*;
public class AfficheImage extends JComponent {
private Image fond;
public AfficheImage(String cheminImage) {
super();
this.fond = Toolkit.getDefaultToolkit().getImage(cheminImage);
}
@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.drawImage(this.fond, 0, 0, this);
}
}

View File

@@ -0,0 +1,27 @@
import javax.swing.*;
import java.awt.*;
public class AfficheImage extends JComponent {
private Image fond;
public AfficheImage(String cheminImage) {
super();
this.fond = Toolkit.getDefaultToolkit().getImage(cheminImage);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(288, 215);
}
@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());
}
int x = (this.getWidth() - fond.getWidth(this)) / 2;
int y = (this.getHeight() - fond.getHeight(this)) / 2;
secondPinceau.drawImage(this.fond, x, y, this);
}
}

Binary file not shown.

View File

@@ -0,0 +1,28 @@
import javax.swing.*;
import java.awt.*;
public class Q3Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame("Acceuil");
fenetre.setLocation(100, 100);
fenetre.setSize(288,223);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setLayout(null);
AfficheImage fond = new AfficheImage("login.jpg");
fond.setSize(278,183);
fond.setLocation(0,5);
JTextField identifiant = new JTextField();
identifiant.setSize(150,29);
identifiant.setLocation(110,95);
JTextField motDePasse = new JTextField();
motDePasse.setSize(150,29);
motDePasse.setLocation(110,135);
fenetre.add(fond);
fenetre.add(identifiant);
fenetre.add(motDePasse);
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,33 @@
import javax.swing.*;
import java.awt.*;
public class Q3Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame("Acceuil");
fenetre.setLocation(100, 100);
fenetre.setSize(288,215);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
AfficheImage fond = new AfficheImage("login.jpg");
fond.setBounds(0, 0, 288, 215);
JTextField identifiant = new JTextField();
identifiant.setBounds(110, 105, 150, 30);
JTextField motDePasse = new JTextField();
motDePasse.setBounds(110, 145, 150, 30);
JPanel entrees = new JPanel();
entrees.setLayout(null);
entrees.setOpaque(false);
entrees.setBounds(0, 0, 288, 215);
entrees.add(identifiant);
entrees.add(motDePasse);
JPanel contenus = new JPanel(null);
contenus.add(fond);
contenus.add(entrees);
fenetre.setContentPane(contenus);
fenetre.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

View File

@@ -0,0 +1,25 @@
import javax.swing.JComponent;
import java.awt.*;
public class Cercle extends JComponent {
public Color couleurCercle;
public Cercle(int r, int g, int b){
this.couleurCercle = new Color(r,g,b);
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
Color couleurFond = this.getBackground();
if (this.isOpaque()) {
secondPinceau.setColor(couleurFond);
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(this.couleurCercle);
secondPinceau.fillOval(0,0, this.getWidth(), this.getHeight());
secondPinceau.setColor(couleurFond);
secondPinceau.fillOval(this.getWidth()/4 , this.getHeight()/4 , this.getWidth()/2 , this.getHeight()/2);
}
}

View File

@@ -0,0 +1,25 @@
import javax.swing.JComponent;
import java.awt.*;
public class Cercle extends JComponent {
public Color couleurCercle;
public Cercle(int r, int g, int b){
this.couleurCercle = new Color(r,g,b);
}
@Override
protected void paintComponent(Graphics pinceau) {
Graphics secondPinceau = pinceau.create();
Color couleurFond = this.getBackground()
if (this.isOpaque()) {
secondPinceau.setColor(couleurFond);
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
secondPinceau.setColor(this.couleurCercle);
secondPinceau.fillOval(0,0, this.getWidth(), this.getHeight());
secondPinceau.setColor(couleurFond);
secondPinceau.fillOval(this.getWidth()/4 , this.getHeight()/4 , 3*this.getWidth()/4 , 3*this.getHeight()/4);
}
}

Binary file not shown.

View File

@@ -0,0 +1,28 @@
import javax.swing.*;
import java.awt.*;
public class Q4Main{
public static void main(String[] args){
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout grille = new GridLayout(5,5);
fenetre.setLayout(grille);
Cercle[][] tabCercle = new Cercle[5][5];
int vert = 0;
for (Cercle[] ligne : tabCercle){
int bleu = 25;
vert += 50;
for (Cercle cercle : ligne){
cercle = new Cercle(0,vert,bleu);
fenetre.add(cercle);
bleu += 50;
}
}
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,16 @@
import javax.swing.*;
import java.awt.*;
public class Q1_Formes{
public static void main(String[] args){
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Cercle[][] listeCercle = new Cercle[25];
fenetre.add(lesDessins);
fenetre.setVisible(true);
}
}