J'ai un jeu vidéo qui s'appelle Fessebouc où j'ai effectué un export de Mac OS X application bundle. Tout a bien marché jusque là mais au moment de l'exécution du .app une erreur s'affiche :
Voici le code source.
Classe Fessebouc :
package fr.fessebouc;
public class Fessebouc {
public static void main(String[] args) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
new Fenetre();
}
}
Classe Fenetre :
package fr.fessebouc;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Fenetre extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel containerInscriptionJPanel = new JPanel();
private JPanel containerConnectionJPanel = new JPanel();
private JPanel containerAccueilJPanel = new JPanel();
private JPanel containerAmisJPanel = new JPanel();
private JPanel pageInscriptionJPanel = new JPanel();
private JPanel pageConnectionJPanel = new JPanel();
private JPanel pageAccueilJPanel = new JPanel();
private JPanel pageAmisJPanel = new JPanel();
private JPanel bordInscriptionJPanel = new JPanel();
private JPanel bordInscriptionJPanel2 = new JPanel();
private JPanel bordConnectionJPanel = new JPanel();
private JPanel bordConnectionJPanel2 = new JPanel();
private JPanel bordAccueilJPanel = new JPanel();
private JPanel bordAccueilJPanel2 = new JPanel();
private JPanel bordAmisJPanel = new JPanel();
private JPanel bordAmisJPanel2 = new JPanel();
private JTextField inscriptionJTextField = new JTextField();
private JTextField connectionJTextField = new JTextField();
private JPasswordField inscriptionJPasswordField = new JPasswordField();
private JPasswordField inscriptionJPasswordField2 = new JPasswordField();
private JPasswordField connectionJPasswordField = new JPasswordField();
private JLabel inscriptionJLabel = new JLabel("Identifiant : ");
private JLabel inscriptionJLabel2 = new JLabel("Mot de passe : ");
private JLabel inscriptionJLabel3 = new JLabel("Confirmation : ");
private JButton inscriptionJButton = new JButton("Valider");
private JLabel connectionJLabel = new JLabel("Identifiant : ");
private JLabel connectionJLabel2 = new JLabel("Mot de passe : ");
private JButton connectionJButton = new JButton("Valider");
private JMenuBar menuBar = new JMenuBar();
private JMenu fichierJMenu = new JMenu("Fichier");
private JMenu compteJMenu = new JMenu("Compte");
private JMenu aProposJMenu = new JMenu("À propos");
private JMenuItem item = new JMenuItem("Inscription");
private JMenuItem item2 = new JMenuItem("Connection");
private JMenuItem item3 = new JMenuItem("Quitter");
private JMenuItem item4 = new JMenuItem("Accueil");
private JMenuItem item5 = new JMenuItem("?");
private JMenuItem item6 = new JMenuItem("Amis");
private JMenuItem item7 = new JMenuItem("Paramètres");
private JMenuItem item8 = new JMenuItem("Changer de mot de passe");
private JLabel accueilJLabel = new JLabel("<html>Bienvenue dans Fessebouc!<br>...<br>...<br>...</html>");
private JLabel amisJLabel = new JLabel("<html>Liste des amis : <br>Moi<br>Moi<br>Et... Moi!</html>");
private JLabel metierJLabel = new JLabel("Métier : ");
private JComboBox<String> metierJComboBox = new JComboBox<String>();
private JLabel favorisJLabel = new JLabel("Chose favorite : ");
private JComboBox<String> favorisJComboBox = new JComboBox<String>();
private JLabel caractereJLabel = new JLabel("Caractères : ");
private JComboBox<String> caractereJComboBox = new JComboBox<String>();
private JComboBox<String> caractereJComboBox2 = new JComboBox<String>();
private JLabel ageJLabel = new JLabel("Âge : ");
private JComboBox<String> ageJComboBox = new JComboBox<String>();
private JLabel poidsJLabel = new JLabel("Poids : ");
private JComboBox<String> poidsJComboBox = new JComboBox<String>();
private JLabel passeTempsJLabel = new JLabel("Passe temps : ");
private JComboBox<String> passeTempsJComboBox = new JComboBox<String>();
private List<String> donneesIdentite = new ArrayList<String>();
private String identifiantString;
public Fenetre() {
setTitle("Inscription à Fessebouc");
setSize(900, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
// Action de Fichier/Inscription
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
inscriptionJTextField.setText("");
inscriptionJPasswordField.setText("");
inscriptionJPasswordField2.setText("");
inscriptionJTextField.setEnabled(true);
inscriptionJPasswordField.setEnabled(true);
inscriptionJPasswordField2.setEnabled(true);
inscriptionJButton.setEnabled(true);
containerInscriptionJPanel.setVisible(true);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(false);
containerAmisJPanel.setVisible(false);
setContentPane(containerInscriptionJPanel);
setTitle("Inscription à Fessebouc");
}
});
// Action de Fichier/Connection
item2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
connectionJTextField.setText("");
connectionJPasswordField.setText("");
connectionJTextField.setEnabled(true);
connectionJPasswordField.setEnabled(true);
connectionJButton.setEnabled(true);
containerInscriptionJPanel.setVisible(false);
containerConnectionJPanel.setVisible(true);
containerAccueilJPanel.setVisible(false);
containerAmisJPanel.setVisible(false);
setContentPane(containerConnectionJPanel);
setTitle("Connection à Fessebouc");
}
});
// Action de Fichier/Quitter
item3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
// Action de Fichier/Accueil
item4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
containerInscriptionJPanel.setVisible(false);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(true);
containerAmisJPanel.setVisible(false);
setContentPane(containerAccueilJPanel);
setTitle("Accueil de Fessebouc");
}
});
// Action de À propos/?
item5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JFrame help = new JFrame();
JPanel container = new JPanel();
JLabel texte = new JLabel("<html>Bienvenue dans Fessebouc !<br>"
+ "Cet application est un jeu RJ permettant d'avoir des oreilles et des yeux partout dans un<br>"
+ "monde virtuel sans limites !<br>"
+ "Ce monde se crée au fur et à mesure des posts communiqués par vous ou par les ordis.<br>"
+ "Tout d'abord, créez un compte en saisissant votre identifiant et votre mot de passe. Vous<br>"
+ "devrez entrer des informations sur votre identité pour que le jeu puisse créer des posts<br>"
+ "appropriés.</html>");
help.setTitle("Aide");
help.setSize(600, 300);
help.setLocationRelativeTo(null);
container.add(texte);
container.setBackground(Color.MAGENTA);
help.setContentPane(container);
help.setVisible(true);
}
});
// Action de Amis
item6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
containerInscriptionJPanel.setVisible(false);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(false);
containerAmisJPanel.setVisible(true);
setContentPane(containerAmisJPanel);
setTitle("Amis");
}
});
// Action de Paramètres
item7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
// Action de Changer de mot de passe
item8.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Path fichierPasswords = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/passwords.txt");
Path fichierIdentifiants = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/identifiants.txt");
try {
Files.readAllLines(fichierIdentifiants);
if (Files.readAllLines(fichierPasswords).get(0) == Fenetre
.fonctionHachage(JOptionPane.showInputDialog(null, "Entrer votre ancien mot de passe : ",
"Changement de mot de passe", JOptionPane.QUESTION_MESSAGE))) {
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
});
// Ajouts des boutons dans les menus
fichierJMenu.add(item);
fichierJMenu.add(item2);
fichierJMenu.add(item3);
aProposJMenu.add(item5);
compteJMenu.add(item6);
compteJMenu.add(item7);
compteJMenu.add(item8);
menuBar.add(fichierJMenu);
menuBar.add(aProposJMenu);
// Début de containerInscriptionJPanel
{
containerInscriptionJPanel.setLayout(new BorderLayout());
bordInscriptionJPanel.setBackground(Color.RED);
pageInscriptionJPanel.setBackground(Color.GRAY);
bordInscriptionJPanel2.setBackground(Color.RED);
Font police = new Font("Courier new", Font.PLAIN, 14);
inscriptionJTextField.setFont(police);
inscriptionJTextField.setPreferredSize(new Dimension(150, 30));
inscriptionJPasswordField.setFont(police);
inscriptionJPasswordField.setPreferredSize(new Dimension(150, 30));
inscriptionJPasswordField2.setFont(police);
inscriptionJPasswordField2.setPreferredSize(new Dimension(150, 30));
inscriptionJButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!inscriptionJTextField.getText().equals("")
&& !new String(inscriptionJPasswordField.getPassword()).equals("")
&& new String(inscriptionJPasswordField2.getPassword())
.equals(new String(inscriptionJPasswordField.getPassword()))) {
inscriptionJButton.setEnabled(false);
inscriptionJTextField.setEnabled(false);
inscriptionJPasswordField.setEnabled(false);
inscriptionJPasswordField2.setEnabled(false);
runInscription();
} else if (inscriptionJTextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Veuillez entrer un identifiant.", "Erreur",
JOptionPane.ERROR_MESSAGE);
} else if (new String(inscriptionJPasswordField.getPassword()).equals("")) {
JOptionPane.showMessageDialog(null, "Veuillez entrer un mot de passe.", "Erreur",
JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(null, "Votre confirmation n'est pas validée.", "Erreur",
JOptionPane.ERROR_MESSAGE);
inscriptionJPasswordField2.setText("");
}
}
});
pageInscriptionJPanel.add(inscriptionJLabel);
pageInscriptionJPanel.add(inscriptionJTextField);
pageInscriptionJPanel.add(inscriptionJLabel2);
pageInscriptionJPanel.add(inscriptionJPasswordField);
pageInscriptionJPanel.add(inscriptionJLabel3);
pageInscriptionJPanel.add(inscriptionJPasswordField2);
pageInscriptionJPanel.add(inscriptionJButton);
pageInscriptionJPanel.add(metierJLabel);
pageInscriptionJPanel.add(metierJComboBox);
pageInscriptionJPanel.add(favorisJLabel);
pageInscriptionJPanel.add(favorisJComboBox);
pageInscriptionJPanel.add(caractereJLabel);
pageInscriptionJPanel.add(caractereJComboBox);
pageInscriptionJPanel.add(caractereJComboBox2);
pageInscriptionJPanel.add(passeTempsJLabel);
pageInscriptionJPanel.add(passeTempsJComboBox);
pageInscriptionJPanel.add(ageJLabel);
pageInscriptionJPanel.add(ageJComboBox);
pageInscriptionJPanel.add(poidsJLabel);
pageInscriptionJPanel.add(poidsJComboBox);
metierJComboBox.addItem("Programmeur/Informaticien/Technicien");
metierJComboBox.addItem("Médecin/Infirmier/Vétérinaire");
metierJComboBox.addItem("Jardinier/Paysagiste");
metierJComboBox.addItem("Scientifique/Physicien/Chimicien");
metierJComboBox.addItem("Usineur/Tailleur");
metierJComboBox.addItem("Cuisinier/Patissier/Boulangier");
metierJComboBox.addItem("Sportif");
metierJComboBox.addItem("Architecte/Batisseur");
metierJComboBox.addItem("Écrivain");
metierJComboBox.addItem("Peintre/Dessinateur");
favorisJComboBox.addItem("Jeux vidéo");
favorisJComboBox.addItem("Jeux de société");
favorisJComboBox.addItem("Ordinateur");
favorisJComboBox.addItem("Tablette");
favorisJComboBox.addItem("Portable/Smartphone");
favorisJComboBox.addItem("Livre/Bouquin");
caractereJComboBox.addItem("Joyeux");
caractereJComboBox.addItem("Énergique");
caractereJComboBox.addItem("Méchant/Agressif");
caractereJComboBox.addItem("Malin");
caractereJComboBox.addItem("Tordu");
caractereJComboBox2.addItem("Énergique");
caractereJComboBox2.addItem("Méchant/Agressif");
caractereJComboBox2.addItem("Joyeux");
caractereJComboBox2.addItem("Malin");
caractereJComboBox2.addItem("Tordu");
passeTempsJComboBox.addItem("Jouer/S'amuser");
passeTempsJComboBox.addItem("Lire/Bouquiner");
passeTempsJComboBox.addItem("Faire du sport");
passeTempsJComboBox.addItem("Parler/Blablater");
passeTempsJComboBox.addItem("Enquiquiner/Ennuimerder");
ageJComboBox.addItem("12-15");
ageJComboBox.addItem("15-18");
ageJComboBox.addItem("18-25");
ageJComboBox.addItem("25-35");
ageJComboBox.addItem("35-46");
ageJComboBox.addItem("46-58");
ageJComboBox.addItem("58-70");
ageJComboBox.addItem("70+");
poidsJComboBox.addItem("45-60");
poidsJComboBox.addItem("60-80");
poidsJComboBox.addItem("80-100");
poidsJComboBox.addItem("100-120");
containerInscriptionJPanel.add(bordInscriptionJPanel, BorderLayout.WEST);
containerInscriptionJPanel.add(pageInscriptionJPanel, BorderLayout.CENTER);
containerInscriptionJPanel.add(bordInscriptionJPanel2, BorderLayout.EAST);
} // Fin de containerInscriptionJPanel
// Début de containerConnectionJPanel
{
containerConnectionJPanel.setLayout(new BorderLayout());
bordConnectionJPanel.setBackground(Color.RED);
pageConnectionJPanel.setBackground(Color.GRAY);
bordConnectionJPanel2.setBackground(Color.RED);
Font police = new Font("Courier new", Font.PLAIN, 14);
connectionJTextField.setFont(police);
connectionJTextField.setPreferredSize(new Dimension(150, 30));
connectionJPasswordField.setFont(police);
connectionJPasswordField.setPreferredSize(new Dimension(150, 30));
connectionJButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!connectionJTextField.getText().equals("")
&& !new String(connectionJPasswordField.getPassword()).equals("")) {
connectionJButton.setEnabled(false);
connectionJTextField.setEnabled(false);
connectionJPasswordField.setEnabled(false);
runConnection();
} else if (connectionJTextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Veuillez entrer un identifiant.", "Erreur",
JOptionPane.ERROR_MESSAGE);
} else if (new String(connectionJPasswordField.getPassword()).equals("")) {
JOptionPane.showMessageDialog(null, "Veuillez entrer un mot de passe.", "Erreur",
JOptionPane.ERROR_MESSAGE);
}
}
});
pageConnectionJPanel.add(connectionJLabel);
pageConnectionJPanel.add(connectionJTextField);
pageConnectionJPanel.add(connectionJLabel2);
pageConnectionJPanel.add(connectionJPasswordField);
pageConnectionJPanel.add(connectionJButton);
containerConnectionJPanel.add(bordConnectionJPanel, BorderLayout.WEST);
containerConnectionJPanel.add(pageConnectionJPanel, BorderLayout.CENTER);
containerConnectionJPanel.add(bordConnectionJPanel2, BorderLayout.EAST);
} // Fin de containerConnectionJPanel
// Début de containerAccueilJPanel
{
containerAccueilJPanel.setLayout(new BorderLayout());
bordAccueilJPanel.setBackground(Color.RED);
pageAccueilJPanel.setBackground(Color.GRAY);
bordAccueilJPanel2.setBackground(Color.RED);
Font police = new Font("Courier new", Font.PLAIN, 14);
accueilJLabel.setFont(police);
pageAccueilJPanel.add(accueilJLabel);
containerAccueilJPanel.add(bordAccueilJPanel, BorderLayout.WEST);
containerAccueilJPanel.add(pageAccueilJPanel, BorderLayout.CENTER);
containerAccueilJPanel.add(bordAccueilJPanel2, BorderLayout.EAST);
} // Fin de containerAccueilJPanel
// Début de containerAmisJPanel
{
containerAmisJPanel.setLayout(new BorderLayout());
bordAmisJPanel.setBackground(Color.RED);
pageAmisJPanel.setBackground(Color.GRAY);
bordAmisJPanel2.setBackground(Color.RED);
Font police = new Font("Courier new", Font.PLAIN, 14);
amisJLabel.setFont(police);
pageAmisJPanel.add(amisJLabel);
containerAmisJPanel.add(bordAmisJPanel, BorderLayout.WEST);
containerAmisJPanel.add(pageAmisJPanel, BorderLayout.CENTER);
containerAmisJPanel.add(bordAmisJPanel2, BorderLayout.EAST);
} // Fin de containerAmisJPanel
containerInscriptionJPanel.setVisible(true);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(false);
setContentPane(containerInscriptionJPanel);
setJMenuBar(menuBar);
setVisible(true);
JFrame help = new JFrame();
JPanel container = new JPanel();
JLabel texte = new JLabel("<html>Bienvenue dans Fessebouc !<br>"
+ "Cet application est un jeu RJ permettant d'avoir des oreilles et des yeux partout dans un<br>"
+ "monde virtuel sans limites !<br>"
+ "Ce monde se crée au fur et à mesure des posts communiqués par vous ou par les ordis.<br>"
+ "Tout d'abord, créez un compte en saisissant votre identifiant et votre mot de passe. Vous<br>"
+ "devrez entrer des informations sur votre identité pour que le jeu puisse créer des posts<br>"
+ "appropriés</html>");
help.setTitle("Aide");
help.setSize(600, 300);
help.setLocationRelativeTo(null);
container.add(texte);
container.setBackground(Color.MAGENTA);
help.setContentPane(container);
help.setVisible(true);
}
protected void runConnection() {
String identifiantString = connectionJTextField.getText();
String passwordString = new String(connectionJPasswordField.getPassword());
List<String> identifantStrings = null;
List<String> passwordStrings = null;
Path fichierIdentifiants = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/identifiants.txt");
try {
identifantStrings = Files.readAllLines(fichierIdentifiants);
} catch (NoSuchFileException e1) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 060437 au serveur.", "Erreur",
JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} catch (IOException e) {
e.printStackTrace();
}
if (!identifantStrings.contains(identifiantString)) {
JOptionPane.showInternalMessageDialog(null,
"Cet identifiant n'existe pas. Pour vous inscrire, cliquez sur Fichier/Inscription", "Erreur",
JOptionPane.ERROR_MESSAGE);
connectionJTextField.setText("");
connectionJTextField.setEnabled(true);
connectionJPasswordField.setEnabled(true);
connectionJButton.setEnabled(true);
return;
}
Path fichierPasswords = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/passwords.txt");
Path fichierDonneesIdentite = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/donneesIdentite.txt");
try {
passwordStrings = Files.readAllLines(fichierPasswords);
} catch (IOException e) {
e.printStackTrace();
}
passwordString = Fenetre.fonctionHachage(passwordString);
if (!passwordString.equals(passwordStrings.get(identifantStrings.indexOf(identifiantString)))) {
JOptionPane.showInternalMessageDialog(null, "Votre mot de passe n'est pas valide.", "Erreur",
JOptionPane.ERROR_MESSAGE);
connectionJPasswordField.setText("");
connectionJTextField.setEnabled(true);
connectionJPasswordField.setEnabled(true);
connectionJButton.setEnabled(true);
return;
}
donneesIdentite.clear();
try {
String string = "";
String string2 = "";
string = Files.readAllLines(fichierDonneesIdentite).get(0);
for (char carac : string.toCharArray()) {
if (carac == ';') {
donneesIdentite.add(string2);
string2 = "";
} else {
string2 += carac;
}
}
} catch (IOException e) {
e.printStackTrace();
}
JOptionPane.showMessageDialog(null, "Connection réussie !", "Fin de traitement",
JOptionPane.INFORMATION_MESSAGE);
this.identifiantString = identifiantString;
menuBar.getMenu(0).add(item4, 2);
menuBar.add(compteJMenu, 1);
containerInscriptionJPanel.setVisible(false);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(true);
setTitle("Accueil");
setContentPane(containerAccueilJPanel);
}
private void runInscription() {
String identifiantString = inscriptionJTextField.getText();
String passwordString = new String(inscriptionJPasswordField.getPassword());
List<String> identifantStrings = null;
passwordString = Fenetre.fonctionHachage(passwordString);
Path fichierIdentifiants = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/identifiants.txt");
try {
identifantStrings = Files.readAllLines(fichierIdentifiants);
} catch (NoSuchFileException e1) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 060437 au serveur.", "Erreur",
JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} catch (IOException e) {
e.printStackTrace();
}
if (identifantStrings.contains(identifiantString)) {
JOptionPane.showInternalMessageDialog(null, "Cet identifiant a déjà était utilisé.", "Erreur",
JOptionPane.ERROR_MESSAGE);
inscriptionJTextField.setText("");
inscriptionJTextField.setEnabled(true);
inscriptionJPasswordField.setEnabled(true);
inscriptionJPasswordField2.setEnabled(true);
inscriptionJButton.setEnabled(true);
return;
}
Path fichierDonneesIdentite = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/donneesIdentite.txt");
Path fichierPasswords = Paths
.get("/Users/lydiejullien/Java/eclipse-workspace/Fessebouc/fichiers/passwords.txt");
if (!fichierDonneesIdentite.toFile().exists() && !fichierPasswords.toFile().exists()) {
if (!fichierDonneesIdentite.toFile().exists()) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 677965 au serveur.",
"Erreur", JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} else {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 859001 au serveur.",
"Erreur", JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
}
}
try {
Files.write(fichierIdentifiants, (identifiantString + "\n").getBytes(), StandardOpenOption.APPEND);
} catch (NoSuchFileException e) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 060437 au serveur.", "Erreur",
JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} catch (IOException e) {
e.printStackTrace();
}
try {
Files.write(fichierPasswords, (passwordString + "\n").getBytes(), StandardOpenOption.APPEND);
} catch (NoSuchFileException e) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 859001 au serveur.", "Erreur",
JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} catch (IOException e) {
e.printStackTrace();
}
donneesIdentite.clear();
donneesIdentite.add(metierJComboBox.getSelectedItem().toString());
donneesIdentite.add(favorisJComboBox.getSelectedItem().toString());
donneesIdentite.add(caractereJComboBox.getSelectedItem().toString());
donneesIdentite.add(passeTempsJComboBox.getSelectedItem().toString());
donneesIdentite.add(ageJComboBox.getSelectedItem().toString());
donneesIdentite.add(poidsJComboBox.getSelectedItem().toString());
try {
for (int i = 0; i < donneesIdentite.size(); i++) {
Files.write(fichierDonneesIdentite, donneesIdentite.get(i).getBytes(), StandardOpenOption.APPEND);
Files.write(fichierDonneesIdentite, ";".getBytes(), StandardOpenOption.APPEND);
}
Files.write(fichierDonneesIdentite, "\n".getBytes(), StandardOpenOption.APPEND);
} catch (NoSuchFileException e) {
JOptionPane.showMessageDialog(null,
"Base de donnée non détecté.\nVeuillez communiquer le code d'erreur 677965 au serveur.", "Erreur",
JOptionPane.ERROR_MESSAGE);
System.exit(0);
return;
} catch (IOException e) {
e.printStackTrace();
}
JOptionPane.showMessageDialog(null,
"Inscription réussie !\nVous allez être automatiquement transporté à l'accueil.", "Fin de traitement",
JOptionPane.INFORMATION_MESSAGE);
this.identifiantString = identifiantString;
menuBar.getMenu(0).add(item4, 2);
menuBar.add(compteJMenu, 1);
containerInscriptionJPanel.setVisible(false);
containerConnectionJPanel.setVisible(false);
containerAccueilJPanel.setVisible(true);
setTitle("Accueil");
setContentPane(containerAccueilJPanel);
}
private static String fonctionHachage(String passwordString) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
}
md.update(passwordString.getBytes());
byte byteData[] = md.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
String hex = Integer.toHexString(0xff & byteData[i]);
if (hex.length() == 1)
hexString.append('0');
hexString.append(hex);
}
return hexString.toString();
}
}
(Je sais que ça fait beaucoup de code)
C'est bon, c'est fini. En bonus voici tous les paramètres de l'export :
Si vous m'aidez ça serait vraiment sympa, je suis un peu bloqué actuellement.
Cordialement,
Moi
(PS : Si vous ne l'avez pas compris, je suis sur Mac)
- Edité par LydieJullien 31 juillet 2021 à 12:28:39
Voilà. Merci beaucoup de m'avoir répondu, et d'ailleurs je ne l'avais pas du tout remarqué la petite incohérence. Je vais essayer de tester les autres options.
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Le cours en Java le plus géniale de la terre : Super cours de Cysboy
Le cours en Java le plus géniale de la terre : Super cours de Cysboy