This commit is contained in:
2023-04-04 14:03:16 +02:00
parent 7021891e9c
commit e32d4de827
111 changed files with 1928 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
//MELIANI SAMY (TP1)
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Debut {
public static void main(String[] args) {
JFrame fenetre = new JFrame("");
fenetre.setSize(650,650);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Debut2 appel1 = new Debut2();
Debut3 appel2 = new Debut3(appel1);
fenetre.addMouseListener(appel2);
fenetre.add(appel1);
fenetre.setVisible(true);
}
}

View File

@@ -0,0 +1,30 @@
//MELIANI SAMY (TP1)
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JComponent;
public class Debut2 extends JComponent {
private int rayon;
public Debut2(){
super();
rayon = 60;
}
public void getrayon(int radius){
this.rayon=radius;
this.repaint();
}
@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(new Color(115,194,251));
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
secondPinceau.setColor(Color.YELLOW);
secondPinceau.fillOval((this.getWidth()/2)-(this.rayon/2), (this.getHeight())-(this.rayon/2), this.rayon, this.rayon);
}
}

View File

@@ -0,0 +1,23 @@
//MELIANI SAMY (TP1)
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Debut3 implements MouseListener{
private int rayon;
private Debut2 ref;
public Debut3(Debut2 appel){
super();
this.rayon=60;
this.ref=appel;
}
public void mouseEntered(MouseEvent evenement){}
public void mousePressed(MouseEvent evenement){}
public void mouseReleased(MouseEvent evenement){}
public void mouseExited(MouseEvent evenement){}
public void mouseClicked(MouseEvent evenement){
this.rayon+=20;
ref.getrayon(this.rayon);
}
}