TP
This commit is contained in:
BIN
DEV2.1/TP12/01_Memoire/FermetureFenetre.class
Normal file
BIN
DEV2.1/TP12/01_Memoire/FermetureFenetre.class
Normal file
Binary file not shown.
97
DEV2.1/TP12/01_Memoire/FermetureFenetre.java
Normal file
97
DEV2.1/TP12/01_Memoire/FermetureFenetre.java
Normal file
@@ -0,0 +1,97 @@
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.awt.event.WindowListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.*;
|
||||
|
||||
public class FermetureFenetre implements WindowListener {
|
||||
|
||||
private JPanel panneau;
|
||||
private JFrame fenetre;
|
||||
|
||||
public FermetureFenetre(JFrame fenetre, JPanel panneau) {
|
||||
super();
|
||||
this.fenetre = fenetre;
|
||||
this.panneau = panneau;
|
||||
}
|
||||
|
||||
public void windowActivated(WindowEvent evenement) {
|
||||
|
||||
} // premier plan
|
||||
|
||||
public void windowClosed(WindowEvent evenement) {
|
||||
|
||||
}
|
||||
public void windowClosing(WindowEvent evenement) {
|
||||
try {
|
||||
Dimension dims = this.fenetre.getSize();
|
||||
Point loc = this.fenetre.getLocation();
|
||||
Color color = this.panneau.getBackground();
|
||||
FileOutputStream fichier = new FileOutputStream("windowlocation.bin");
|
||||
DataOutputStream flux = new DataOutputStream(fichier);
|
||||
|
||||
try {
|
||||
flux.writeInt((int) loc.getX());
|
||||
flux.writeInt((int) loc.getY());
|
||||
flux.writeInt((int) dims.getWidth());
|
||||
flux.writeInt((int) dims.getHeight());
|
||||
flux.writeInt(color.getRed());
|
||||
flux.writeInt(color.getGreen());
|
||||
flux.writeInt(color.getBlue());
|
||||
} catch (IOException e2){
|
||||
System.out.println("Erreur d'écriture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e3) {
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
} // avant fermeture
|
||||
|
||||
public void windowDeactivated(WindowEvent evenement) {
|
||||
|
||||
} // arrière-plan
|
||||
|
||||
public void windowDeiconified(WindowEvent evenement) {
|
||||
|
||||
} // restauration
|
||||
|
||||
public void windowIconified(WindowEvent evenement){
|
||||
|
||||
} // minimisation
|
||||
|
||||
public void windowOpened(WindowEvent evenement) {
|
||||
try {
|
||||
FileInputStream fichier = new FileInputStream("windowlocation.bin");
|
||||
DataInputStream flux = new DataInputStream(fichier);
|
||||
|
||||
try {
|
||||
|
||||
if (flux.available() >= 28) {
|
||||
this.fenetre.setLocation(flux.readInt(), flux.readInt());
|
||||
this.fenetre.setSize(flux.readInt(), flux.readInt());
|
||||
this.panneau.setBackground(new Color(flux.readInt(), flux.readInt(), flux.readInt()));
|
||||
System.out.println(this.panneau.getBackground() + "");
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e5) {
|
||||
System.out.println("Erreur de lecture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e6) {
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
|
||||
} catch (IOException e4) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/01_Memoire/Fond$1.class
Normal file
BIN
DEV2.1/TP12/01_Memoire/Fond$1.class
Normal file
Binary file not shown.
BIN
DEV2.1/TP12/01_Memoire/Fond$2.class
Normal file
BIN
DEV2.1/TP12/01_Memoire/Fond$2.class
Normal file
Binary file not shown.
BIN
DEV2.1/TP12/01_Memoire/Fond$3.class
Normal file
BIN
DEV2.1/TP12/01_Memoire/Fond$3.class
Normal file
Binary file not shown.
BIN
DEV2.1/TP12/01_Memoire/Fond.class
Normal file
BIN
DEV2.1/TP12/01_Memoire/Fond.class
Normal file
Binary file not shown.
46
DEV2.1/TP12/01_Memoire/Fond.java
Normal file
46
DEV2.1/TP12/01_Memoire/Fond.java
Normal file
@@ -0,0 +1,46 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class Fond {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
JPanel panneau = new JPanel();
|
||||
FermetureFenetre evenementFenetre = new FermetureFenetre(fenetre, panneau);
|
||||
fenetre.addWindowListener(evenementFenetre);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setLayout(new GridLayout(1, 1));
|
||||
|
||||
|
||||
JButton bouton1 = new JButton("Cyan");
|
||||
JButton bouton2 = new JButton("Magenta");
|
||||
JButton bouton3 = new JButton("Jaune");
|
||||
|
||||
bouton1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evenement) {
|
||||
panneau.setBackground(Color.CYAN);
|
||||
}
|
||||
});
|
||||
|
||||
bouton2.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evenement) {
|
||||
panneau.setBackground(Color.MAGENTA);
|
||||
}
|
||||
});
|
||||
|
||||
bouton3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evenement) {
|
||||
panneau.setBackground(Color.YELLOW);
|
||||
}
|
||||
});
|
||||
|
||||
panneau.add(bouton1);
|
||||
panneau.add(bouton2);
|
||||
panneau.add(bouton3);
|
||||
|
||||
fenetre.add(panneau);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/01_Memoire/windowlocation.bin
Normal file
BIN
DEV2.1/TP12/01_Memoire/windowlocation.bin
Normal file
Binary file not shown.
16
DEV2.1/TP12/02_Polygone/Fenetre.java
Normal file
16
DEV2.1/TP12/02_Polygone/Fenetre.java
Normal file
@@ -0,0 +1,16 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
public Fenetre() {
|
||||
this.setSize(500, 600);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLayout(new GridLayout(1, 1));
|
||||
LectureFichier lecture = new LectureFichier();
|
||||
EcritureFichier ecriture = new EcritureFichier("test", lecture.getCoordY(), lecture.getNbPoints());
|
||||
this.add(new Polygone(lecture.getCoordX(), lecture.getCoordY(), lecture.getNbPoints()));
|
||||
EcritureFichier ecriture = new EcritureFichier(lecture.getCoordX(), lecture.getCoordY(), lecture.getNbPoints());
|
||||
}
|
||||
}
|
54
DEV2.1/TP12/02_Polygone/LectureFichier.java
Normal file
54
DEV2.1/TP12/02_Polygone/LectureFichier.java
Normal file
@@ -0,0 +1,54 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class LectureFichier {
|
||||
|
||||
private int[] coordX;
|
||||
private int[] coordY;
|
||||
private int nbPoints;
|
||||
|
||||
public LectureFichier() {
|
||||
|
||||
try {
|
||||
FileInputStream fichier = new FileInputStream("polygone.bin");
|
||||
DataInputStream flux = new DataInputStream(fichier);
|
||||
|
||||
this.coordX = new int[flux.available()/8];
|
||||
this.coordY = new int[flux.available()/8];
|
||||
this.nbPoints = flux.available()/8;
|
||||
|
||||
int compteur = 0;
|
||||
|
||||
try {
|
||||
while (flux.available() > 0) {
|
||||
this.coordX[compteur] = flux.readInt();
|
||||
this.coordY[compteur] = flux.readInt();
|
||||
compteur++;
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
System.out.println("Erreur de lecture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e3) {
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getCoordX() {
|
||||
return this.coordX;
|
||||
}
|
||||
|
||||
public int[] getCoordY() {
|
||||
return this.coordY;
|
||||
}
|
||||
|
||||
public int getNbPoints() {
|
||||
return this.nbPoints;
|
||||
}
|
||||
}
|
6
DEV2.1/TP12/02_Polygone/Main.java
Normal file
6
DEV2.1/TP12/02_Polygone/Main.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
28
DEV2.1/TP12/02_Polygone/Polygone.java
Normal file
28
DEV2.1/TP12/02_Polygone/Polygone.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Polygone extends JComponent {
|
||||
|
||||
private int[] coordX;
|
||||
private int[] coordY;
|
||||
private int nbPoints;
|
||||
|
||||
public Polygone(int[] coordX, int[] coordY, int nbPoints) {
|
||||
this.coordX = coordX;
|
||||
this.coordY = coordY;
|
||||
this.nbPoints = nbPoints;
|
||||
}
|
||||
|
||||
@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(Color.BLUE);
|
||||
secondPinceau.fillPolygon(this.coordX, this.coordY, this.nbPoints);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/02_Polygone/polygone.bin
Normal file
BIN
DEV2.1/TP12/02_Polygone/polygone.bin
Normal file
Binary file not shown.
BIN
DEV2.1/TP12/03_Homothetie/EcritureFichier.class
Normal file
BIN
DEV2.1/TP12/03_Homothetie/EcritureFichier.class
Normal file
Binary file not shown.
47
DEV2.1/TP12/03_Homothetie/EcritureFichier.java
Normal file
47
DEV2.1/TP12/03_Homothetie/EcritureFichier.java
Normal file
@@ -0,0 +1,47 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class EcritureFichier {
|
||||
|
||||
private int[] coordX;
|
||||
private int[] coordY;
|
||||
private int nbPoints;
|
||||
private boolean aMultiplier;
|
||||
|
||||
public EcritureFichier(int[] coordX, int[] coordY, int nbPoints, boolean aMultiplier) {
|
||||
this.coordX = coordX;
|
||||
this.coordY = coordY;
|
||||
this.nbPoints = nbPoints;
|
||||
this.aMultiplier = aMultiplier;
|
||||
|
||||
try {
|
||||
FileOutputStream fichier = new FileOutputStream("polygone.bin");
|
||||
DataOutputStream flux = new DataOutputStream(fichier);
|
||||
|
||||
try{
|
||||
for (int i = 0; i != nbPoints; i++) {
|
||||
if (this.aMultiplier) {
|
||||
flux.writeInt(this.coordX[i]*2);
|
||||
flux.writeInt(this.coordY[i]*2);
|
||||
}
|
||||
else {
|
||||
flux.writeInt(this.coordX[i]/2);
|
||||
flux.writeInt(this.coordY[i]/2);
|
||||
}
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
System.out.println("Erreur d'écriture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
System.out.println("Fin de l'écriture");
|
||||
} catch (IOException e3) {
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/03_Homothetie/Fenetre.class
Normal file
BIN
DEV2.1/TP12/03_Homothetie/Fenetre.class
Normal file
Binary file not shown.
15
DEV2.1/TP12/03_Homothetie/Fenetre.java
Normal file
15
DEV2.1/TP12/03_Homothetie/Fenetre.java
Normal file
@@ -0,0 +1,15 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
public Fenetre(boolean aMultiplier) {
|
||||
this.setSize(500, 600);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLayout(new GridLayout(1, 1));
|
||||
LectureFichier lecture = new LectureFichier();
|
||||
this.add(new Polygone(lecture.getCoordX(), lecture.getCoordY(), lecture.getNbPoints()));
|
||||
EcritureFichier ecriture = new EcritureFichier(lecture.getCoordX(), lecture.getCoordY(), lecture.getNbPoints(), aMultiplier);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/03_Homothetie/LectureFichier.class
Normal file
BIN
DEV2.1/TP12/03_Homothetie/LectureFichier.class
Normal file
Binary file not shown.
54
DEV2.1/TP12/03_Homothetie/LectureFichier.java
Normal file
54
DEV2.1/TP12/03_Homothetie/LectureFichier.java
Normal file
@@ -0,0 +1,54 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class LectureFichier {
|
||||
|
||||
private int[] coordX;
|
||||
private int[] coordY;
|
||||
private int nbPoints;
|
||||
|
||||
public LectureFichier() {
|
||||
|
||||
try {
|
||||
FileInputStream fichier = new FileInputStream("polygone.bin");
|
||||
DataInputStream flux = new DataInputStream(fichier);
|
||||
|
||||
this.coordX = new int[flux.available()/8];
|
||||
this.coordY = new int[flux.available()/8];
|
||||
this.nbPoints = flux.available()/8;
|
||||
|
||||
int compteur = 0;
|
||||
|
||||
try {
|
||||
while (flux.available() > 0) {
|
||||
this.coordX[compteur] = flux.readInt();
|
||||
this.coordY[compteur] = flux.readInt();
|
||||
compteur++;
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
System.out.println("Erreur de lecture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e3) {
|
||||
System.out.println("Erreur de fermeture");
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getCoordX() {
|
||||
return this.coordX;
|
||||
}
|
||||
|
||||
public int[] getCoordY() {
|
||||
return this.coordY;
|
||||
}
|
||||
|
||||
public int getNbPoints() {
|
||||
return this.nbPoints;
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/03_Homothetie/Main.class
Normal file
BIN
DEV2.1/TP12/03_Homothetie/Main.class
Normal file
Binary file not shown.
14
DEV2.1/TP12/03_Homothetie/Main.java
Normal file
14
DEV2.1/TP12/03_Homothetie/Main.java
Normal file
@@ -0,0 +1,14 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre;
|
||||
try {
|
||||
if (args[0].equals("diviser")) {
|
||||
fenetre = new Fenetre(false);
|
||||
}
|
||||
else {
|
||||
fenetre = new Fenetre(true);
|
||||
}
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/03_Homothetie/Polygone.class
Normal file
BIN
DEV2.1/TP12/03_Homothetie/Polygone.class
Normal file
Binary file not shown.
28
DEV2.1/TP12/03_Homothetie/Polygone.java
Normal file
28
DEV2.1/TP12/03_Homothetie/Polygone.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Polygone extends JComponent {
|
||||
|
||||
private int[] coordX;
|
||||
private int[] coordY;
|
||||
private int nbPoints;
|
||||
|
||||
public Polygone(int[] coordX, int[] coordY, int nbPoints) {
|
||||
this.coordX = coordX;
|
||||
this.coordY = coordY;
|
||||
this.nbPoints = nbPoints;
|
||||
}
|
||||
|
||||
@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(Color.BLUE);
|
||||
secondPinceau.fillPolygon(this.coordX, this.coordY, this.nbPoints);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/03_Homothetie/polygone.bin
Normal file
BIN
DEV2.1/TP12/03_Homothetie/polygone.bin
Normal file
Binary file not shown.
BIN
DEV2.1/TP12/04_Trainee/ClicCase.class
Normal file
BIN
DEV2.1/TP12/04_Trainee/ClicCase.class
Normal file
Binary file not shown.
40
DEV2.1/TP12/04_Trainee/ClicCase.java
Normal file
40
DEV2.1/TP12/04_Trainee/ClicCase.java
Normal file
@@ -0,0 +1,40 @@
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class ClicCase implements MouseListener {
|
||||
|
||||
private JPanel[][] cases;
|
||||
private int[][] grille;
|
||||
private int caseX;
|
||||
private int caseY;
|
||||
|
||||
public ClicCase(JPanel[][] cases, int[][] grille, int caseX, int caseY) {
|
||||
this.cases = cases;
|
||||
this.grille = grille;
|
||||
this.caseX = caseX;
|
||||
this.caseY = caseY;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent evenement) {
|
||||
this.cases[this.caseX][this.caseY].setLayout(new GridLayout());
|
||||
this.cases[this.caseX][this.caseY].add(new Image());
|
||||
} // un bouton cliqué
|
||||
|
||||
public void mouseEntered(MouseEvent evenement) {
|
||||
|
||||
} // debut du survol
|
||||
|
||||
public void mouseExited(MouseEvent evenement) {
|
||||
|
||||
} // fin du survol
|
||||
|
||||
public void mousePressed(MouseEvent evenement) {
|
||||
|
||||
} // un bouton appuyé
|
||||
|
||||
public void mouseReleased(MouseEvent evenement) {
|
||||
|
||||
} // un bouton relâché
|
||||
|
||||
}
|
BIN
DEV2.1/TP12/04_Trainee/Fenetre.class
Normal file
BIN
DEV2.1/TP12/04_Trainee/Fenetre.class
Normal file
Binary file not shown.
29
DEV2.1/TP12/04_Trainee/Fenetre.java
Normal file
29
DEV2.1/TP12/04_Trainee/Fenetre.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
public Fenetre() {
|
||||
this.setSize(500,500);
|
||||
this.setLocation(100,100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.setLayout(new GridLayout(10, 10));
|
||||
|
||||
JPanel[][] cases = new JPanel[10][10];
|
||||
int[][] grille = new int[10][10];
|
||||
|
||||
for (int i = 0; i != 10; i++) {
|
||||
for (int j = 0; j != 10; j++) {
|
||||
cases[i][j] = new JPanel();
|
||||
cases[i][j].setBackground(new Color(37, 150, 190));
|
||||
cases[i][j].setBorder(BorderFactory.createLineBorder(Color.WHITE));
|
||||
cases[i][j].addMouseListener(new ClicCase(cases, grille, i, j));
|
||||
this.add(cases[i][j]);
|
||||
|
||||
grille[i][j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/04_Trainee/GestionGrille.class
Normal file
BIN
DEV2.1/TP12/04_Trainee/GestionGrille.class
Normal file
Binary file not shown.
35
DEV2.1/TP12/04_Trainee/GestionGrille.java
Normal file
35
DEV2.1/TP12/04_Trainee/GestionGrille.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class GestionGrille {
|
||||
|
||||
private int[][] grille;
|
||||
private Point[] coordsTrainee;
|
||||
private Point coordJoueur;
|
||||
|
||||
public GestionGrille(Point[] coordsTrainee, Point coordJoueur) {
|
||||
for (int i = 0; i != 10; i++) {
|
||||
for (int j = 0; j != 10; j++) {
|
||||
this.grille[i][j] = 0;
|
||||
}
|
||||
}
|
||||
this.coordsTrainee = coordsTrainee;
|
||||
this.coordJoueur = coordJoueur;
|
||||
}
|
||||
|
||||
public boolean deplacementPossible(Point destination) {
|
||||
if (this.coordJoueur.getX() == destination.getX()
|
||||
&& this.coordJoueur.getY() == destination.getY()-1) {
|
||||
return true;
|
||||
}
|
||||
else if (this.coordJoueur.getX() == destination.getX()
|
||||
&& this.coordJoueur.getY() == destination.getY()+1) {
|
||||
return true;
|
||||
}
|
||||
else if (this.coordJoueur.getX() == destination.getX()+1
|
||||
&& this.coordJoueur.getY() == destination.getY()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
13
DEV2.1/TP12/04_Trainee/Image.java
Normal file
13
DEV2.1/TP12/04_Trainee/Image.java
Normal file
@@ -0,0 +1,13 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Image extends JComponent {
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
|
||||
Image img = Toolkit.getDefaultToolkit().getImage("vaisseau.png");
|
||||
secondPinceau.drawImage(img, 0, 0, this);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/04_Trainee/Main.class
Normal file
BIN
DEV2.1/TP12/04_Trainee/Main.class
Normal file
Binary file not shown.
6
DEV2.1/TP12/04_Trainee/Main.java
Normal file
6
DEV2.1/TP12/04_Trainee/Main.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP12/04_Trainee/vaisseau.png
Normal file
BIN
DEV2.1/TP12/04_Trainee/vaisseau.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 718 B |
Reference in New Issue
Block a user