Problème con mais important pour moi..[JAVA]

Problème con mais important pour moi..[JAVA] - Programmation

Marsh Posté le 11-02-2001 à 20:23:16    

Voila j'ai un travail plutot simple avec une fenêtre , le programme n'est pas finit mais je comprend pas pourquoi la ligne super("Facturation spectacles" ); me fait une erreur, voila un copie-coller de ce que j'ai fait a date :
 
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
 
 
public class FenetreSpectacle extends JFrame implements ActionListener
{
  private final int MAX_SPECTACLES = 15;
 
  private JLabel labelNoSpectacle, labelDescript, labelPrix,
          labelNbBillet, labelTotal;
  private JTextField champNoSpectacle, champDescript, champPrix,
   champNbBillet, champTotal;
  private JButton boutonTerminer, boutonInitialiser;
 
  private int tabNoSpectacle[] = new int[MAX_SPECTACLES];
  private String tabDescript[] = new String[MAX_SPECTACLES];
  private double tabPrix[] = new double[MAX_SPECTACLES];
 
 
  public void FenetreSpectacle() throws IOException
  {
    int j;
    super("Facturation de spectacle" );
 
 
    BufferedReader fichier = new BufferedReader (new FileReader("a:spectacles.txt" ));
    String ligne;
 
    for (j = 0; j < MAX_SPECTACLES; j++);
    {
      ligne = fichier.readLine();
      tabNoSpectacle[j] = Integer.parseInt(ligne.substring(0,5));
      tabDescript[j] = ligne.substring(6,26);
      tabPrix[j] = Double.parseDouble(ligne.substring(27));
    }
 
    Container c = getContentPane();
    c. setLayout(new GridLayout(6,2,6,6));
 
    labelNoSpectacle = new JLabel("Numéro de spectacle : ",SwingConstants.RIGHT);
    champNoSpectacle = new JTextField();
    champNoSpectacle.addActionListener(this);
    c.add(labelNoSpectacle);
    c.add(champNoSpectacle);
 
    labelDescript = new JLabel("Description : ", SwingConstants.RIGHT);
    champDescript = new JTextField();
    champDescript.setEditable(false);
    c.add(labelDescript);
    c.add(champDescript);
 
    labelPrix = new JLabel("Prix : ", SwingConstants.RIGHT);
    champPrix = new JTextField();
    champPrix.setEditable(false);
    c.add(labelPrix);
    c.add(champPrix);
 
    labelNbBillet = new JLabel("Nombre de billets : ",SwingConstants.RIGHT);
    champNbBillet = new JTextField();
    champNbBillet.addActionListener(this);
    c.add(labelNbBillet);
    c.add(champNbBillet);
 
    labelTotal = new JLabel("Total : ", SwingConstants.RIGHT);
    champTotal = new JTextField();
    champTotal.setEditable(false);
    c.add(labelTotal);
    c.add(champTotal);
 
    boutonTerminer = new JButton("Terminer" );
    boutonTerminer.addActionListener(this);
    c.add(boutonTerminer);
 
    boutonInitialiser = new JButton("Initialiser" );
    boutonInitialiser.addActionListener(this);
    c.add(boutonInitialiser);
 
    setLocation(200,200);
    show();
 
  }
 
  public void actionPerformed(ActionEvent e)
  {
  int noSpectacle, nbBillet, posi;
  double tabTotal[] = new double[MAX_SPECTACLES];
 
    if (e.getSource() == champNoSpectacle)
    {
      noSpectacle = Integer.parseInt(champNoSpectacle.getText());
      posi = Outil.rechercheBinaire(noSpectacle,tabNoSpectacle,MAX_SPECTACLES);
      if (posi == -1)
 JOptionPane.showMessageDialog(null,"Numéro de spectacle inexistant!","ERREUR",
 JOptionPane.ERROR_MESSAGE);
      else
      {
        champDescript.setText(tabDescript[posi]);
        champPrix.setText(Double.toString(tabPrix[posi]));
      }
    }
 
 
 
 
  }
 
 
  public static void main(String[] args)
  {
  FenetreSpectacle fenetreSpectacle = new FenetreSpectacle();
 
  fenetreSpectacle.addWindowListener
     (new WindowAdapter()
       {
    public void windowClosing(WindowEvent e)
    {
      System.exit(0);
    }
       } );
  }
 
}

Reply

Marsh Posté le 11-02-2001 à 20:23:16   

Reply

Marsh Posté le 11-02-2001 à 20:37:56    

Il faut sans doute que super("..." ) soit la première expression du corps du constructeur.

Reply

Marsh Posté le 11-02-2001 à 20:41:28    

ouaip


---------------
http://www.cheata.net le site qui vous donne la banane!
Reply

Marsh Posté le 11-02-2001 à 21:37:37    

Toujours la même erreur même après avoir fait passer le super avant l'initiation de ma variable

Reply

Marsh Posté le 11-02-2001 à 21:41:54    

Faut sans doute que tu vires le "void" dans la definition du constructeur.
Et c'est quoi l'erreur renvoyée exactement ?

Reply

Marsh Posté le 11-02-2001 à 22:02:58    

AH hehe c'était bien le void :) mais bon je comprend pas paske quand je le virais tantot il me donnais une erreur qui m'empêchais de compiler...
 
eh bien merci a toi!!!

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed