Mettre les données dans un tableau en java

Résolu
bsmaiga Messages postés 2 Date d'inscription jeudi 23 septembre 2010 Statut Membre Dernière intervention 11 janvier 2011 - 6 janv. 2011 à 17:01
bsmaiga Messages postés 2 Date d'inscription jeudi 23 septembre 2010 Statut Membre Dernière intervention 11 janvier 2011 - 11 janv. 2011 à 13:19
je serai tres avis de compter sur vous de m'aider a mettre les données dans un tableau en java.
Au secour, Au secour !!!!!!!!!!

2 réponses

cs_laurent1024 Messages postés 987 Date d'inscription mardi 31 mai 2005 Statut Membre Dernière intervention 30 août 2012 25
6 janv. 2011 à 17:57
Bonjour.
Au lieu de crier au secours, tu pourrais peut être décrire un peu plus ce que tu veux faire. :)
3
bsmaiga Messages postés 2 Date d'inscription jeudi 23 septembre 2010 Statut Membre Dernière intervention 11 janvier 2011
11 janv. 2011 à 13:19
bonjour Laurent1024
oui je crois que ta raison en faites voici le codes source de mon programme. le programme s'exécute correctement, et les informations taper sont directement transféré dans un fiche word. Et ce que je voulais c'était de mettre ces information dans un tableau.

import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class AppliSaisie {
public static void main(String[]args) {
FicheSaisie fen = new FicheSaisie();
fen.setBounds(300,300,500,450);
fen.setVisible(true);
}
}
@SuppressWarnings("serial")
class FicheSaisie extends Frame{
Button bout1 = new Button();
Label label1 = new Label();
Label label2 = new Label();
Label label3 = new Label();
Label label4 = new Label();
TextField text1 = new TextField();
TextField text2 = new TextField();
TextField text3 = new TextField();
TextField text4 = new TextField();
TextField text5 = new TextField();
TextField text6 = new TextField();
CheckboxGroup checkboxgoup = new CheckboxGroup();
Checkbox group1 = new Checkbox();
Checkbox group2 = new Checkbox();
Checkbox group3 = new Checkbox();

private String EtatCivil;
private FileWriter fluxwrite;
private BufferedWriter fluxout;

public FicheSaisie(){
Initialiser();
}

private void AutoriserSave(){
if(text1.getText().length() != 0 && checkboxgoup.getSelectedCheckbox() != null)
bout1.setEnabled(true);
else
bout1.setEnabled(false);
}
private void StoreEtatCivil(){
this.AutoriserSave();
if(checkboxgoup.getSelectedCheckbox() != null)
this.EtatCivil = checkboxgoup.getSelectedCheckbox().getLabel();
else
this.EtatCivil = " ";
}
private void ecrireEnreg(String record){
try{
fluxout.write(record);
fluxout.newLine();
}
catch(IOException err){
System.out.println("Erreur" +err);
}
}
private void Initialiser(){
this.setResizable(false);
this.setLayout(null);
this.setSize(500, 450);
this.setTitle("FAST - Licence Informatique");
this.setBackground(Color.darkGray);
this.setForeground(Color.black);

bout1.setBounds(150,400,200,30);
bout1.setLabel("Validez Votre Entrée");
bout1.setEnabled(false);
label1.setBounds(45, 125, 70, 23);
label1.setText("NOM");
label2.setBounds(45,160,70,23);
label2.setText("PRENOM");
label3.setBounds(45,190,70,23);
label3.setText("DATE NSCE");
label4.setBounds(45,220,70,30);
label4.setText("MLLE");
group1.setBounds(20, 25, 88, 23);
group1.setCheckboxGroup(checkboxgoup);
group1.setLabel("Madame");
group2.setBounds(20, 55, 108, 23);
group2.setCheckboxGroup(checkboxgoup);
group2.setLabel("Mademoiselle");
group3.setBounds(20, 85, 88, 23);
group3.setCheckboxGroup(checkboxgoup);
group3.setLabel("Monsieur");
text1.setBackground(Color.white);
text1.setBounds(120, 125, 198, 23);
text1.setText(" ");
text2.setBackground(Color.white);
text2.setBounds(120, 160, 198, 23);
text2.setText(" ");
text3.setBackground(Color.white);
text3.setBounds(120, 192, 30, 23);
text3.setText(" ");
text4.setBackground(Color.white);
text4.setBounds(155, 192, 30, 23);
text4.setText(" ");
text5.setBackground(Color.white);
text5.setBounds(190, 192, 50, 23);
text5.setText(" ");
text6.setBackground(Color.white);
text6.setBounds(120, 225, 198, 23);
text6.setText(" ");


this.add(group1);
this.add(group2);
this.add(group3);
this.add(label1);
this.add(label2);
this.add(label3);
this.add(label4);
this.add(text2);
this.add(text1);
this.add(text3);
this.add(text4);
this.add(text5);
this.add(text6);
this.add(bout1);

EtatCivil = " ";
try{
fluxwrite = new FileWriter("Etudiant.xls", true);
fluxout = new BufferedWriter(fluxwrite);
}
catch(IOException err){
System.out.println( "Problème dans l'ouverture du fichier ");
}
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
try{
fluxout.close();
}
catch(IOException err){
System.out.println("Impossible de fermer le fiche");
}
System.exit(100);
}
});
text1.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
text2.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
text3.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
text4.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
text5.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
text6.addTextListener(new TextListener(){
public void textValueChanged(TextEvent e){
AutoriserSave();
}
});
group1.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e){
StoreEtatCivil();
}
});
group2.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e){
StoreEtatCivil();
}
});
group3.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e){
StoreEtatCivil();
}
});
bout1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
ecrireEnreg(EtatCivil+": "+text2.getText()+" "+text1.getText()+" "+text3.getText()+" "+text4.getText()+" "+text5.getText()+" "+text6.getText());
}
});
}
}

import java.awt.*;
import java.awt.event.*;

public class InscriptionBSM {
public static void main(String[]args){
Inscription fen = new Inscription();
fen.setBounds(350,350,400,350);
fen.setVisible(true);
}
}
@SuppressWarnings("serial")
class Inscription extends Frame{

Button bout1 = new Button();
Label label1 = new Label();
TextField text = new TextField();
CheckboxGroup checkboxgroup = new CheckboxGroup();
Checkbox group1 = new Checkbox();
Checkbox group2 = new Checkbox();
Checkbox group3 = new Checkbox();

public Inscription(){
Initialiser();
}
private void Initialiser(){
this.setResizable(false);
this.setSize(400,350);
this.setTitle("FAST - Fiche Inscription");
this.setBackground(Color.magenta);
this.setLayout(null);
this.setForeground(Color.black);
bout1.setBounds(130,300,150,30);
bout1.setLabel(" Validez ");
Font police = new Font("ALGERIAN", Font.ITALIC, 20);
group1.setBounds(150, 70, 150, 40);
group1.setCheckboxGroup(checkboxgroup);
group1.setLabel("1er ANNEE");
group1.setFont(police);
group2.setBounds(150, 120, 150, 40);
group2.setCheckboxGroup(checkboxgroup);
group2.setLabel("2e ANNEE");
group2.setFont(police);
group3.setBounds(150, 170, 150, 40);
group3.setCheckboxGroup(checkboxgroup);
group3.setLabel("3e ANNEE");
group3.setFont(police);

this.add(bout1);
this.add(group1);
this.add(group2);
this.add(group3);

this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
bout1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(e.getSource() == bout1){
FicheSaisie fen = new FicheSaisie();
fen.setBounds(300,300,500,450);
fen.setVisible(true);
}
}
});

}
}
0
Rejoignez-nous