TP
This commit is contained in:
BIN
DEV2.1/TDs/Fenetre.class
Normal file
BIN
DEV2.1/TDs/Fenetre.class
Normal file
Binary file not shown.
0
DEV2.1/TDs/Fenetre.java
Normal file
0
DEV2.1/TDs/Fenetre.java
Normal file
BIN
DEV2.1/TDs/Img.class
Normal file
BIN
DEV2.1/TDs/Img.class
Normal file
Binary file not shown.
43
DEV2.1/TDs/Img.java
Normal file
43
DEV2.1/TDs/Img.java
Normal file
@@ -0,0 +1,43 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Img extends JComponent {
|
||||
private Image img;
|
||||
|
||||
public Img() {
|
||||
// Chargement de l'image
|
||||
img = new ImageIcon("fond.png").getImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (img != null) {
|
||||
g.drawImage(img, 0, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(500, 500); // Ajustez à la taille de l'image
|
||||
}
|
||||
}
|
||||
|
||||
class Fenetre extends JFrame {
|
||||
public Fenetre() {
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Img imagePanel = new Img();
|
||||
this.add(imagePanel);
|
||||
|
||||
this.pack(); // Ajuste la fenêtre à la taille du contenu
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
SwingUtilities.invokeLater(Fenetre::new);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TDs/Main.class
Normal file
BIN
DEV2.1/TDs/Main.class
Normal file
Binary file not shown.
39
DEV2.1/TDs/Main.java
Normal file
39
DEV2.1/TDs/Main.java
Normal file
@@ -0,0 +1,39 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
class Img extends JComponent {
|
||||
private Image img;
|
||||
|
||||
public Img() {
|
||||
// Chargement de l'image
|
||||
img = Toolkit.getDefaultToolkit().getImage("triangles-1430105_1280.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (img != null) {
|
||||
g.drawImage(img, 0, 0, this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Fenetre extends JFrame {
|
||||
public Fenetre() {
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
Img imagePanel = new Img();
|
||||
this.add(imagePanel);
|
||||
|
||||
this.pack(); // Ajuste la fenêtre à la taille du contenu
|
||||
}
|
||||
}
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TDs/Reels.class
Normal file
BIN
DEV2.1/TDs/Reels.class
Normal file
Binary file not shown.
35
DEV2.1/TDs/Reels.java
Normal file
35
DEV2.1/TDs/Reels.java
Normal file
@@ -0,0 +1,35 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Reels {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileWriter fichier = new FileWriter("reels.txt");
|
||||
BufferedWriter flux = new BufferedWriter(fichier);
|
||||
|
||||
try {
|
||||
flux.write("12.8391319");
|
||||
flux.newLine();
|
||||
flux.write("45.72");
|
||||
flux.newLine();
|
||||
flux.write("12.283939273718317174");
|
||||
flux.newLine();
|
||||
flux.write("1.0");
|
||||
flux.newLine();
|
||||
|
||||
} catch (IOException e2 ) {
|
||||
System.out.println("Erreur d'écriture");
|
||||
}
|
||||
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e3) {
|
||||
|
||||
System.out.println("Erreur de femreture");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("Erreur d'ouverture");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
BIN
DEV2.1/TDs/Somme.class
Normal file
BIN
DEV2.1/TDs/Somme.class
Normal file
Binary file not shown.
9
DEV2.1/TDs/Somme.java
Normal file
9
DEV2.1/TDs/Somme.java
Normal file
@@ -0,0 +1,9 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Somme {
|
||||
public static void main(String[] args) {
|
||||
InputStreamReader lecture = new InputStreamReader(System.in);
|
||||
BufferedReader flux = new BufferedReader(lecture);
|
||||
}
|
||||
}
|
BIN
DEV2.1/TDs/fond.png
Normal file
BIN
DEV2.1/TDs/fond.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 476 KiB |
Binary file not shown.
4
DEV2.1/TDs/reels.txt
Normal file
4
DEV2.1/TDs/reels.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
12.8391319
|
||||
45.72
|
||||
12.283939273718317174
|
||||
1.0
|
BIN
DEV2.1/TDs/triangles-1430105_1280.png
Normal file
BIN
DEV2.1/TDs/triangles-1430105_1280.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 648 KiB |
BIN
DEV2.1/TDs/triangles-1430105_1280.webp
Normal file
BIN
DEV2.1/TDs/triangles-1430105_1280.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 476 KiB |
Reference in New Issue
Block a user