repartition des 2 programmes
This commit is contained in:
parent
c9efc37ef3
commit
657eadee2a
@ -8,13 +8,13 @@ JVMFLAGS =
|
||||
|
||||
### REGLES ESSENTIELLES ###
|
||||
|
||||
main.class : main.java menu.class
|
||||
main.class : mainProgramme2.java menuProgramme2.class
|
||||
${JC} ${JCFLAGS} main.java
|
||||
|
||||
grille.class : grille.java resolveurGrille.class
|
||||
${JC} ${JCFLAGS} grille.java
|
||||
|
||||
menu.class : menu.java resolveurGrille.class grille.class
|
||||
menu.class : menuProgramme2.java resolveurGrille.class grille.class
|
||||
${JC} ${JCFLAGS} menu.java
|
||||
|
||||
resolveurGrille.class : resolveurGrille.java
|
||||
@ -22,13 +22,13 @@ resolveurGrille.class : resolveurGrille.java
|
||||
|
||||
### REGLES OPTIONNELLES ###
|
||||
|
||||
run : main.class
|
||||
run : mainProgramme2.class
|
||||
${JVM} ${JVMFLAGS} main
|
||||
|
||||
clean :
|
||||
-rm -f *.class
|
||||
|
||||
mrproper : clean main.class
|
||||
mrproper : clean mainProgramme2.class
|
||||
|
||||
### BUTS FACTICES ###
|
||||
|
||||
|
@ -69,13 +69,16 @@ public class grille extends JComponent{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*bouton(s) grille(s)*/
|
||||
JPanel bouton_grille = new JPanel();
|
||||
bouton_grille.setSize(900,200);
|
||||
bouton_grille.setSize(300,200);
|
||||
bouton_grille.setLayout(new BorderLayout());
|
||||
JButton verifier = new JButton("verifier");
|
||||
bouton_grille.add(verifier);
|
||||
fenetre.add(bouton_grille,BorderLayout.SOUTH);
|
||||
fenetre.add(place_grille, BorderLayout.CENTER);
|
||||
|
||||
/*affichage fenetre*/
|
||||
fenetre.setVisible(true);
|
||||
|
||||
@ -127,4 +130,8 @@ public class grille extends JComponent{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void ExporterGrille(int[][] grille){
|
||||
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
|
||||
public class main {
|
||||
public static void main(String[] args) {
|
||||
menu.menuFenetre();
|
||||
}
|
||||
}
|
6
Sudoku/mainProgramme1.java
Normal file
6
Sudoku/mainProgramme1.java
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
public class mainProgramme1 {
|
||||
public static void main(String[] args) {
|
||||
menuProgramme1.menuProgramme1();
|
||||
}
|
||||
}
|
6
Sudoku/mainProgramme2.java
Normal file
6
Sudoku/mainProgramme2.java
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
public class mainProgramme2 {
|
||||
public static void main(String[] args) {
|
||||
menuProgramme2.menuProgramme2();
|
||||
}
|
||||
}
|
107
Sudoku/menuProgramme1.java
Normal file
107
Sudoku/menuProgramme1.java
Normal file
@ -0,0 +1,107 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
|
||||
|
||||
public class menuProgramme1 {
|
||||
|
||||
private static String cheminFichier = null;
|
||||
|
||||
public static void menuProgramme1() {
|
||||
/*fenetre*/
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 200);
|
||||
fenetre.setTitle("Sudoku Creator (By Wilfried BRIGITTE & Julian GALLEGO)");
|
||||
fenetre.setResizable(false);
|
||||
fenetre.setLocationRelativeTo(null);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
GridLayout gestionnaire = new GridLayout(4,1);
|
||||
fenetre.setLayout(gestionnaire);
|
||||
|
||||
/*composants G*/
|
||||
|
||||
JLabel titre = new JLabel("Sudoku Creator");
|
||||
titre.setHorizontalAlignment(JLabel.CENTER);
|
||||
titre.setFont(new Font("Arial", Font.PLAIN, 25));
|
||||
fenetre.add(titre, BorderLayout.CENTER);
|
||||
|
||||
JPanel ligne3 = new JPanel();
|
||||
JButton ouvrir = new JButton("Ouvrir");
|
||||
JLabel nomFichier = new JLabel("Fichier ouvert : ");
|
||||
ligne3.add(ouvrir);
|
||||
ligne3.add(nomFichier);
|
||||
fenetre.add(ligne3, BorderLayout.CENTER);
|
||||
|
||||
JPanel ligne4 = new JPanel();
|
||||
JButton editerGrilleVierge = new JButton("Editer Grille Vierge");
|
||||
JButton editerGrilleSelectionner = new JButton("Editer Grille Selectionner");
|
||||
JButton quitter = new JButton("Quitter");
|
||||
ligne4.add(editerGrilleVierge);
|
||||
ligne4.add(editerGrilleSelectionner);
|
||||
ligne4.add(quitter);
|
||||
fenetre.add(ligne4, BorderLayout.CENTER);
|
||||
|
||||
JLabel InfoLogiciel = new JLabel(" Info : Tout est normal");
|
||||
InfoLogiciel.setHorizontalAlignment(JLabel.LEFT);
|
||||
InfoLogiciel.setFont(new Font("Arial", Font.PLAIN, 11));
|
||||
fenetre.add(InfoLogiciel);
|
||||
|
||||
/*affichage*/
|
||||
fenetre.setVisible(true);
|
||||
|
||||
/*evenements*/
|
||||
ouvrir.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
JFileChooser filechooser = new JFileChooser();
|
||||
filechooser.setCurrentDirectory(new File("./grille"));
|
||||
int result = filechooser.showOpenDialog(null);
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedFile = filechooser.getSelectedFile();
|
||||
nomFichier.setText("Fichier ouvert : " + selectedFile.getName());
|
||||
cheminFichier = selectedFile.getAbsolutePath();
|
||||
InfoLogiciel.setText(" Info : Tout est normal");
|
||||
InfoLogiciel.setForeground(Color.BLACK);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.err.println("Erreur selection du fichier");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editerGrilleVierge.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e4){
|
||||
int[][] grille_vide = null;
|
||||
grille_vide = new int[9][9];
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int j = 0; j < 9 ; j++ ) {
|
||||
grille_vide[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fenetre.dispose();
|
||||
grille.AfficherGrille(grille_vide, true);
|
||||
}
|
||||
});
|
||||
|
||||
editerGrilleSelectionner.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e4){
|
||||
if (cheminFichier == null){
|
||||
InfoLogiciel.setText(" Info : Erreur : Veuillez selectionner un fichier .gri");
|
||||
InfoLogiciel.setForeground(Color.RED);
|
||||
}else{
|
||||
fenetre.dispose();
|
||||
grille.AfficherGrille(grille.ChargerGrille(cheminFichier), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
quitter.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e3) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -4,12 +4,12 @@ import java.awt.event.*;
|
||||
import java.io.*;
|
||||
|
||||
|
||||
public class menu {
|
||||
public class menuProgramme2 {
|
||||
|
||||
private static String cheminFichier = null;
|
||||
private static boolean ResolutionManuel = true;
|
||||
|
||||
public static void menuFenetre() {
|
||||
public static void menuProgramme2() {
|
||||
/*fenetre*/
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 250);
|
||||
@ -47,10 +47,8 @@ public class menu {
|
||||
fenetre.add(ligne3, BorderLayout.CENTER);
|
||||
|
||||
JPanel ligne4 = new JPanel();
|
||||
JButton editer = new JButton("Editer");
|
||||
JButton lancer = new JButton("Lancer");
|
||||
JButton quitter = new JButton("Quitter");
|
||||
ligne4.add(editer);
|
||||
ligne4.add(lancer);
|
||||
ligne4.add(quitter);
|
||||
fenetre.add(ligne4, BorderLayout.CENTER);
|
||||
@ -83,27 +81,6 @@ public class menu {
|
||||
}
|
||||
});
|
||||
|
||||
editer.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e4){
|
||||
if (cheminFichier == null){
|
||||
int[][] grille_vide = null;
|
||||
grille_vide = new int[9][9];
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
for (int j = 0; j < 9 ; j++ ) {
|
||||
grille_vide[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fenetre.dispose();
|
||||
grille.AfficherGrille(grille_vide, true);
|
||||
}else{
|
||||
fenetre.dispose();
|
||||
grille.AfficherGrille(grille.ChargerGrille(cheminFichier), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
lancer.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e2) {
|
||||
if(cheminFichier != null){
|
Loading…
Reference in New Issue
Block a user