diff --git a/DEV.2.1/TP/TP8-Evenements/2.Attente/Attente.java b/DEV.2.1/TP/TP8-Evenements/2.Attente/Attente.java new file mode 100644 index 0000000..35ecf47 --- /dev/null +++ b/DEV.2.1/TP/TP8-Evenements/2.Attente/Attente.java @@ -0,0 +1,37 @@ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class Attente extends JComponent implements WindowsListener { + public Attente() { + super(); + + } + + @Override + protected void paintComponent(Graphics pinceau) { + Graphics secondPinceau = pinceau.create(); + secondPinceau.setColor(this.getForeground()); + + int col = 5; + int ligne = 5; + int caseWidth = getWidth() / col; + int caseHeight = getHeight() / ligne; + secondPinceau.setColor(Color.CYAN); + int[] xPoints = {0,caseWidth * col, 0, caseWidth * col}; + int[] yPoints = {0,0,caseHeight * ligne, caseHeight * ligne}; + secondPinceau.fillPolygon(xPoints, yPoints, 4); + } + + @Override + protected void windowDeactivated(WindowEvent evenement) { + System.out.println("Fenetre arri pl") + } + + @Override public void windowActivated(WindowsEvent e) {} + @Override public void windowOpened(WindowsEvent e) {} + @Override public void windowClosing(WindowsEvent e) {} + @Override public void windowClosed(WindowsEvent e) {} + @Override public void windowIconified(WindowsEvent e) {} + @Override public void windowDeiconified(WindowsEvent e) {} +} \ No newline at end of file diff --git a/DEV.2.1/TP/TP8-Evenements/2.Attente/MainAttente.java b/DEV.2.1/TP/TP8-Evenements/2.Attente/MainAttente.java new file mode 100644 index 0000000..68ae2a6 --- /dev/null +++ b/DEV.2.1/TP/TP8-Evenements/2.Attente/MainAttente.java @@ -0,0 +1,15 @@ +import javax.swing.*; +import java.awt.*; + +public class MainFond { + public static void main(String[] args) { + JFrame frame = new JFrame("Attente"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + Attente test = new Attente(); + + frame.setSize(500,500); + frame.setLocation(500,250); + frame.setVisible(true); + } +}