etann es probablemente racista, las sombras de la gente le molestan en el futbolín
This commit is contained in:
BIN
APL2.1/TP8/Attente/Attente.class
Normal file
BIN
APL2.1/TP8/Attente/Attente.class
Normal file
Binary file not shown.
34
APL2.1/TP8/Attente/Attente.java
Normal file
34
APL2.1/TP8/Attente/Attente.java
Normal 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
|
||||
}
|
||||
BIN
APL2.1/TP8/Attente/Disque.class
Normal file
BIN
APL2.1/TP8/Attente/Disque.class
Normal file
Binary file not shown.
49
APL2.1/TP8/Attente/Disque.java
Normal file
49
APL2.1/TP8/Attente/Disque.java
Normal 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;
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP8/Attente/Fenetre.class
Normal file
BIN
APL2.1/TP8/Attente/Fenetre.class
Normal file
Binary file not shown.
17
APL2.1/TP8/Attente/Fenetre.java
Normal file
17
APL2.1/TP8/Attente/Fenetre.java
Normal 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);
|
||||
}
|
||||
}
|
||||
BIN
APL2.1/TP8/Attente/Main.class
Normal file
BIN
APL2.1/TP8/Attente/Main.class
Normal file
Binary file not shown.
10
APL2.1/TP8/Attente/Main.java
Normal file
10
APL2.1/TP8/Attente/Main.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user