tp bd + tp5-6 dev3.2
This commit is contained in:
BIN
DEV/DEV3.2/TP06_Dictionnaires/Q1Main.class
Normal file
BIN
DEV/DEV3.2/TP06_Dictionnaires/Q1Main.class
Normal file
Binary file not shown.
19
DEV/DEV3.2/TP06_Dictionnaires/Q1Main.java
Normal file
19
DEV/DEV3.2/TP06_Dictionnaires/Q1Main.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Q1Main{
|
||||
public static void main(String args[]){
|
||||
Map<Thread, StackTraceElement[]> listeThreadNul = Thread.getAllStackTraces();
|
||||
Set<Map.Entry<Thread, StackTraceElement[]>> listeThread = listeThreadNul.entrySet();
|
||||
for (Map.Entry<Thread, StackTraceElement[]> thread : listeThread) {
|
||||
Thread clef = thread.getKey();
|
||||
StackTraceElement[] valeur = thread.getValue();
|
||||
|
||||
System.out.println(clef.getName() + ":");
|
||||
|
||||
for (StackTraceElement item : valeur){
|
||||
System.out.println(" " + item);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
42
DEV/DEV3.2/TP06_Dictionnaires/Q2Main.java
Normal file
42
DEV/DEV3.2/TP06_Dictionnaires/Q2Main.java
Normal file
@@ -0,0 +1,42 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Q1Main{
|
||||
public static void main(String args[]){
|
||||
String nomFichier = 'rgb.txt';
|
||||
HashMap<String,Color> dicoCouleur;
|
||||
try{
|
||||
BufferedReader lecture = new BufferedReader(new FileReader("rgb.txt"));
|
||||
String ligne;
|
||||
|
||||
try {
|
||||
while ((ligne = lecture.readLine()) != null) {
|
||||
String[] donne = ligne.split("\\s+");
|
||||
int rouge = Integer.parseInt(data[0]);
|
||||
int vert = Integer.parseInt(data[1]);
|
||||
int bleu = Integer.parseInt(data[2]);
|
||||
Color couleur = Color(rouge, vert, bleu);
|
||||
String nom = data[3];
|
||||
|
||||
dicoCouleur.put(nom, couleur);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Erreur de lecture dans rgb.txt !");
|
||||
}
|
||||
|
||||
try {
|
||||
lecture.close();
|
||||
} catch(IOException e) {
|
||||
System.err.println("Erreur de fermeture de rgb.txt !");
|
||||
}
|
||||
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(700, 300);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.setVisible(true);
|
||||
|
||||
} catch(FileNotFoundException e) {
|
||||
System.err.println("Erreur d'ouverture de rgb.txt !");
|
||||
}
|
||||
}
|
||||
}
|
||||
752
DEV/DEV3.2/TP06_Dictionnaires/rgb.txt
Normal file
752
DEV/DEV3.2/TP06_Dictionnaires/rgb.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user