Enregistrer un fichier sous..... [Resolu] - Java - Programmation
Marsh Posté le 24-05-2008 à 19:46:01
Un JFileChooser quoi
Marsh Posté le 26-05-2008 à 16:13:57
Merci pour cette réponse j'ai pu finaliser mon projet.
Il me reste un dernier détail a régler. Lorsque j'ouvre mon fichier (ici un fichier .xls), les é et autres caractères spéciaux sont remplacer par des caractères aléatoires on dirait, et à chaque début de case, il ajoute également des caractères indésirables. Je ne vois pas d'où cela vient. Merci de m'aider a comprendre.
Marsh Posté le 26-05-2008 à 16:43:01
En fait tu veux sauvegarder un fichier texte et l'ouvrir avec Excel ?
Si oui ce n'est certainement pas la classe ObjectOutputStream qui faut utiliser, mais plutot un FileWriter.
Marsh Posté le 26-05-2008 à 19:45:02
En fait j'essaye d'enregistrer les données présentes dans des textarea dans un tableur.
Je vais essayer la méthode du FileWriter.
Merci de ta réponse
Marsh Posté le 26-05-2008 à 20:01:00
Merci beaucoup. Effectivement avec le FileWriter cela enlève les caractères indésirables.
Merci de vos réponses.
Marsh Posté le 23-05-2008 à 19:29:44
Bonjour a tous.
Voila plusieurs jours que je galère a essayer de trouver comment en cliquant sur un bouton, l'utilisateur puisse choisir le répertoir de destination du fichier.
Voici mon code:
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
public class AppletProf extends javax.swing.JApplet {
public String NomCours, LabNomCours, RenvAnn, typeCours, NbreGroupeCours, NbreEtuGroupe,
NbreGroupeLabo, NbreMinMaxGrouLabo, Matiere, Manuel, NbreHeure, ExpInfo, ExpLabo, Prof, AutreProf, NbreHeureAutreProf,
NbreUnitAcred, Note, NoteExplicative, NomFichier;
/** Initializes the applet AppletProf */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked" )
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextPane1 = new javax.swing.JTextPane();
jScrollPane3 = new javax.swing.JScrollPane();
jTextPane2 = new javax.swing.JTextPane();
jScrollPane4 = new javax.swing.JScrollPane();
jTextPane3 = new javax.swing.JTextPane();
jScrollPane5 = new javax.swing.JScrollPane();
jTextPane4 = new javax.swing.JTextPane();
jScrollPane6 = new javax.swing.JScrollPane();
jTextPane5 = new javax.swing.JTextPane();
jScrollPane7 = new javax.swing.JScrollPane();
jTextPane6 = new javax.swing.JTextPane();
jScrollPane8 = new javax.swing.JScrollPane();
jTextPane7 = new javax.swing.JTextPane();
jScrollPane9 = new javax.swing.JScrollPane();
jTextPane8 = new javax.swing.JTextPane();
jScrollPane10 = new javax.swing.JScrollPane();
jTextPane9 = new javax.swing.JTextPane();
jScrollPane11 = new javax.swing.JScrollPane();
jTextPane10 = new javax.swing.JTextPane();
jScrollPane12 = new javax.swing.JScrollPane();
jTextPane11 = new javax.swing.JTextPane();
jScrollPane13 = new javax.swing.JScrollPane();
jTextPane12 = new javax.swing.JTextPane();
jScrollPane14 = new javax.swing.JScrollPane();
jTextPane13 = new javax.swing.JTextPane();
jScrollPane15 = new javax.swing.JScrollPane();
jTextPane14 = new javax.swing.JTextPane();
jScrollPane16 = new javax.swing.JScrollPane();
jTextPane15 = new javax.swing.JTextPane();
jScrollPane17 = new javax.swing.JScrollPane();
jTextPane16 = new javax.swing.JTextPane();
jScrollPane18 = new javax.swing.JScrollPane();
jTextPane17 = new javax.swing.JTextPane();
jScrollPane19 = new javax.swing.JScrollPane();
jTextPane18 = new javax.swing.JTextPane();
jScrollPane20 = new javax.swing.JScrollPane();
jTextPane19 = new javax.swing.JTextPane();
jLabel1.setText("NUMÉRO ET TITRE DU COURS : " );
jButton1.setText("Sauvegarder" );
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel2.setText("RENVOI À L’ANNUAIRE :" );
jLabel3.setText("TYPE DE COURS SELON LE BCAPI :" );
jLabel4.setText("NOMBRE TOTAL DE GROUPES PAR COURS :" );
jLabel5.setText("NOMBRE MIN/MAX D’ÉTUDIANTS PAR GROUPE:" );
jLabel6.setText("NOMBRE TOTAL DE GROUPES DE LABORATOIRE/TRAVAUX DIRIGÉS :" );
jLabel7.setText("NOMBRE MIN/MAX D’ÉTUDIANTS PAR GROUPE DE LABORATOIRE/TRAVAUX DIRIGÉS :" );
jLabel8.setText("MATIÈRES PRINCIPALES : " );
jLabel9.setText("MANUEL(S) DE RÉFÉRENCE :" );
jLabel10.setText("NOMBRE D’HEURES D’INSTRUCTION PAR SEMAINE :" );
jLabel11.setText("EXPÉRIENCE EN INFORMATIQUE :" );
jLabel12.setText("EXPÉRIENCE DE LABORATOIRE :" );
jLabel13.setText("PROFESSEUR EN CHARGE :" );
jLabel14.setText("AUTRES ENSEIGNANTS :" );
jLabel15.setText("ASSISTANTS À L’ENSEIGNEMENT (NOMBRE/HEURES) : " );
jLabel16.setText("CONTENU SELON LES NORMES DU BCAPI (nombre d’unités d’accréditation) :" );
jLabel17.setText("NOTE MOYENNE/TAUX D’ÉCHECS : " );
jLabel18.setText("NOTES EXPLICATIVES QUANT AUX ÉCARTS PAR RAPPORT À L’ANNUAIRE (LE CAS ÉCHÉANT) " );
jLabel19.setText("Nom du Fichier:" );
jScrollPane2.setViewportView(jTextPane1);
jScrollPane3.setViewportView(jTextPane2);
jScrollPane4.setViewportView(jTextPane3);
jScrollPane5.setViewportView(jTextPane4);
jScrollPane6.setViewportView(jTextPane5);
jScrollPane7.setViewportView(jTextPane6);
jScrollPane8.setViewportView(jTextPane7);
jScrollPane9.setViewportView(jTextPane8);
jScrollPane10.setViewportView(jTextPane9);
jScrollPane11.setViewportView(jTextPane10);
jScrollPane12.setViewportView(jTextPane11);
jScrollPane13.setViewportView(jTextPane12);
jScrollPane14.setViewportView(jTextPane13);
jScrollPane15.setViewportView(jTextPane14);
jScrollPane16.setViewportView(jTextPane15);
jScrollPane17.setViewportView(jTextPane16);
jScrollPane18.setViewportView(jTextPane17);
jScrollPane19.setViewportView(jTextPane18);
jScrollPane20.setViewportView(jTextPane19);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(2, 2, 2)
.addComponent(jLabel10)
.addGap(18, 18, 18)
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(807, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel14)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(799, 799, 799))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel16)
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(842, 842, 842))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel18)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane20, javax.swing.GroupLayout.DEFAULT_SIZE, 830, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane19, javax.swing.GroupLayout.DEFAULT_SIZE, 904, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane17, javax.swing.GroupLayout.DEFAULT_SIZE, 904, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 739, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 766, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 904, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 745, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 745, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 719, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane14, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 752, Short.MAX_VALUE)
.addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 752, Short.MAX_VALUE)
.addComponent(jScrollPane15, javax.swing.GroupLayout.DEFAULT_SIZE, 752, Short.MAX_VALUE))))
.addGap(206, 206, 206))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel6))
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel7))
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(jLabel9))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10))
.addGap(17, 17, 17)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(34, 34, 34)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13))
.addGap(21, 21, 21)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel14)
.addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(22, 22, 22)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel15)
.addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(16, 16, 16)
.addComponent(jLabel17))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane19, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel19)
.addComponent(jScrollPane20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addContainerGap())
);
jScrollPane1.setViewportView(jPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 787, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 411, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
NomCours = jTextPane1.getText();
RenvAnn = jTextPane2.getText();
typeCours = jTextPane3.getText();
NbreGroupeCours = jTextPane4.getText();
NbreEtuGroupe = jTextPane5.getText();
NbreGroupeLabo = jTextPane6.getText();
NbreMinMaxGrouLabo = jTextPane7.getText();
Matiere = jTextPane8.getText();
Manuel = jTextPane9.getText();
NbreHeure = jTextPane10.getText();
ExpInfo = jTextPane11.getText();
ExpLabo = jTextPane12.getText();
Prof = jTextPane13.getText();
AutreProf = jTextPane14.getText();
NbreHeureAutreProf = jTextPane15.getText();
NbreUnitAcred = jTextPane16.getText();
Note = jTextPane17.getText();
NoteExplicative = jTextPane18.getText();
NomFichier = jTextPane19.getText();
try {
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(NomFichier+".xls" )));
oos.writeObject(jLabel1.getText()+"\t"+NomCours+"\n" );
oos.writeObject(jLabel2.getText()+"\t"+RenvAnn+"\n" );
oos.writeObject(jLabel3.getText()+"\t"+typeCours+"\n" );
oos.writeObject(jLabel4.getText()+"\t"+NbreGroupeCours+"\n" );
oos.writeObject(jLabel5.getText()+"\t"+NbreEtuGroupe+"\n" );
oos.writeObject(jLabel6.getText()+"\t"+NbreGroupeLabo+"\n" );
oos.writeObject(jLabel7.getText()+"\t"+NbreMinMaxGrouLabo+"\n" );
oos.writeObject(jLabel8.getText()+"\t"+Matiere+"\n" );
oos.writeObject(jLabel9.getText()+"\t"+Manuel+"\n" );
oos.writeObject(jLabel10.getText()+"\t"+NbreHeure+"\n" );
oos.writeObject(jLabel11.getText()+"\t"+ExpInfo+"\n" );
oos.writeObject(jLabel12.getText()+"\t"+ExpLabo+"\n" );
oos.writeObject(jLabel13.getText()+"\t"+Prof+"\n" );
oos.writeObject(jLabel14.getText()+"\t"+AutreProf+"\n" );
oos.writeObject(jLabel15.getText()+"\t"+NbreHeureAutreProf+"\n" );
oos.writeObject(jLabel16.getText()+"\t"+NbreUnitAcred+"\n" );
oos.writeObject(jLabel17.getText()+"\t"+Note+"\n" );
oos.writeObject(jLabel18.getText()+"\t"+NoteExplicative+"\n" );
oos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Mon programme permet aux utilisateurs de rentrer des données qui sont ensuite enregistrées dans un fichier dont le nom est choisi par cet utilisateur. Je voudrais juste qu'en cliquant sur ce bouton, il y ai une sorte de fenêtre "Enregistrer Sous".
Merci de vos réponses.
Maerlynn35
Message édité par Maerlynn35 le 26-05-2008 à 20:03:14