38 lines
1.2 KiB
Java
38 lines
1.2 KiB
Java
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
import java.awt.event.*;
|
||
|
import java.io.*;
|
||
|
import java.io.File;
|
||
|
import java.io.PrintWriter;
|
||
|
import java.io.FileWriter;
|
||
|
import java.io.IOException;
|
||
|
import javax.swing.JFileChooser;
|
||
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
||
|
|
||
|
public class GrilleExisteActionListener implements ActionListener{
|
||
|
private JFrame choixFrame;
|
||
|
|
||
|
public GrilleExisteActionListener(JFrame choixFrame) {
|
||
|
this.choixFrame = choixFrame;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
choixFrame.dispose();
|
||
|
int [][] grille = new int [9][9];
|
||
|
JFileChooser fileChooser = new JFileChooser();
|
||
|
|
||
|
FileNameExtensionFilter filter = new FileNameExtensionFilter("File grille","gri");
|
||
|
fileChooser.setFileFilter(filter);
|
||
|
|
||
|
File workingDirectory = new File(System.getProperty("user.dir"));
|
||
|
fileChooser.setCurrentDirectory(workingDirectory);
|
||
|
JPanel panneau = new JPanel();
|
||
|
int valeur_de_retour = fileChooser.showOpenDialog(panneau);
|
||
|
if(valeur_de_retour == JFileChooser.APPROVE_OPTION) {
|
||
|
Lecteur.lecture(fileChooser.getSelectedFile(), grille);
|
||
|
FenetreModif.fenetreModification(grille);
|
||
|
}
|
||
|
}
|
||
|
}
|