update
This commit is contained in:
37
DEV.2.1/TP/TP8-Evenements/2.Attente/Attente.java
Normal file
37
DEV.2.1/TP/TP8-Evenements/2.Attente/Attente.java
Normal file
@@ -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) {}
|
||||
}
|
15
DEV.2.1/TP/TP8-Evenements/2.Attente/MainAttente.java
Normal file
15
DEV.2.1/TP/TP8-Evenements/2.Attente/MainAttente.java
Normal file
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user