etann es probablemente racista, las sombras de la gente le molestan en el futbolín

This commit is contained in:
Vieira
2022-04-04 15:12:51 +02:00
parent d2d178c4e9
commit bb4a78089a
13 changed files with 5874 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,34 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Attente implements WindowListener{
private JFrame vue;
private Disque dessin = new Disque();
public Attente(JFrame v){
this.vue = v;
}
public void windowActivated(WindowEvent e) // premier plan
{
dessin.Change(true);
vue.repaint();
this.vue.add(dessin,BorderLayout.CENTER);
System.out.println("ok act");
}
public void windowDeactivated(WindowEvent e) // arrière-plan
{
dessin.Change(false);
vue.repaint();
this.vue.add(dessin,BorderLayout.CENTER);
System.out.println("ok deact");
}
public void windowClosed(WindowEvent evenement){} // après fermeture
public void windowClosing(WindowEvent evenement){} // avant fermeture
public void windowDeiconified(WindowEvent evenement){} // restauration
public void windowIconified(WindowEvent evenement){} // minimisation
public void windowOpened(WindowEvent evenement){} // après ouverture
}

Binary file not shown.

View File

@@ -0,0 +1,49 @@
import javax.swing.JComponent;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Polygon;
public class Disque extends JComponent {
private boolean choix = true;
public Disque(){
}
@Override
protected void paintComponent(Graphics pinceau) {
// obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard
Graphics secondPinceau = pinceau.create();
// obligatoire : si le composant n'est pas censé être transparent
if (this.isOpaque()) {
// obligatoire : on repeint toute la surface avec la couleur de fond
secondPinceau.setColor(this.getBackground());
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
}
Color majenta = new Color(255,0,255);
if (this.choix == true)
{
// maintenant on dessine ce que l'on veut
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
secondPinceau.setColor(majenta);
secondPinceau.fillOval(0,0,this.getWidth(), this.getHeight());
}
else if(this.choix == false)
{
int[] x = {0,this.getWidth(),0,this.getWidth(),0};
int[] y = {0,0,this.getHeight(),this.getHeight(),0};
secondPinceau.setColor(Color.GREEN);
secondPinceau.fillRect(0,0,this.getWidth(),this.getHeight());
secondPinceau.setColor(majenta);
Polygon sablier = new Polygon(x,y,4);
secondPinceau.fillPolygon(sablier);
}
}
public void Change(boolean change){
this.choix = change;
}
}

Binary file not shown.

View File

@@ -0,0 +1,17 @@
import javax.swing.*;
import java.awt.*;
public class Fenetre extends JFrame{
public Fenetre(){
Dimension d = new Dimension(400, 400);
this.setSize(400,400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setMinimumSize(d);
this.setLocation(100, 100);
Attente listen = new Attente(this);
this.addWindowListener(listen);
}
}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
import javax.swing.*;
import java.awt.*;
public class Main{
public static void main(String[] args) {
Fenetre fenetre = new Fenetre();
fenetre.setVisible(true);
}
}