Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : applet fonctionne avec applet viewer mais pas dans une page html [ Archives / Applet ] (alala)

mardi 14 juin 2005 à 22:48:32 | applet fonctionne avec applet viewer mais pas dans une page html

alala

 Bonjour tt le monde!!!
J'ai vraiment besoin d'aide.
Je débute en java avec JBuilderX.
   Je dois réaliser un projet dont un des but est de lire des valeurs dans un fichier texte. Ces valeurs sont de la forme "x;x;x;x" où "x" représente la valeur "0" ou "1". En fonction de la valeur de "x", un jRadioBouton doit réagir. par exemple, si "x" prend la valeur "1", le jRadioBouton correspondant doit s'activer et se cocher.
   J'arrive parfaitement à lire dans ce fichier et à faire réagir les jRadioBouton.
   Cependant, quand je lance l'applet à partir de la page html, rien ne se passe, alors qu'avec l'applet viewer tout marche nikel :





   kk1 pourrait-il me dire d'où vient l'erreur? parsk là je nage complètement et je commence à déprimer .
   Merci d'avance pour ceux ki pourront m'aider.

mercredi 15 juin 2005 à 09:13:09 | Re : applet fonctionne avec applet viewer mais pas dans une page html

safisoft


c'est petet un pbm de path des fichiers, tu dois utiliser comme url de ton fichier:
MaClass.class.getClassLoader().getResource("./data.txt");

mercredi 15 juin 2005 à 11:35:37 | Re : applet fonctionne avec applet viewer mais pas dans une page html

alala

Merci safisoft!

ça à l'air pas mal cette ligne de code, mais je vois pas où il faut la mettre.....
Je mets mon code. Si tu pouvais me dire ske je dois changer ce serait génial, parsk je dois finir ce projet en urgence.

Encore merci safisoft.

N.B. : la méthode pr lire le fichier texte se trouve vers la fin.




package projet_ascenseur;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import projet_ascenseur.LireEtatPOAscenseur;
import java.io.*;
import java.util.*;


/**
 * <p>Title: Ascenseur</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class Applet_Ascenseur extends Applet {
  private boolean isStandalone = false;
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  JLabel jLabel5 = new JLabel();
  JRadioButton EtageDestination0 = new JRadioButton();
  JRadioButton EtageDestination1 = new JRadioButton();
  JRadioButton EtageDestination2 = new JRadioButton();
  JRadioButton EtageDestination3 = new JRadioButton();
  JRadioButton EtageActuel0 = new JRadioButton();
  JRadioButton EtageActuel1 = new JRadioButton();
  JRadioButton EtageActuel2 = new JRadioButton();
  JRadioButton EtageActuel3 = new JRadioButton();
  Panel panel1 = new Panel();
  JRadioButton PorteOuverte3 = new JRadioButton();
  JRadioButton PorteFermee3 = new JRadioButton();
  Panel panel2 = new Panel();
  JRadioButton PorteOuverte2 = new JRadioButton();
  JRadioButton PorteFermee2 = new JRadioButton();
  JRadioButton PorteOuverte1 = new JRadioButton();
  JRadioButton PorteFermee1 = new JRadioButton();
  JRadioButton PorteOuverte0 = new JRadioButton();
  JRadioButton PorteFermee0 = new JRadioButton();
  Panel panel3 = new Panel();
  Panel panel4 = new Panel();
  Panel panel5 = new Panel();
  JRadioButton VoyantAllume3 = new JRadioButton();
  JRadioButton VoyantEteint3 = new JRadioButton();
  JRadioButton VoyantAllume2 = new JRadioButton();
  JRadioButton VoyantEteint2 = new JRadioButton();
  JRadioButton VoyantAllume1 = new JRadioButton();
  JRadioButton VoyantEteint1 = new JRadioButton();
  JRadioButton VoyantAllume0 = new JRadioButton();
  JRadioButton VoyantEteint0 = new JRadioButton();
  Panel panel6 = new Panel();
  Panel panel7 = new Panel();
  Panel panel8 = new Panel();
  JRadioButton Urgence1 = new JRadioButton();
  JRadioButton Urgence2 = new JRadioButton();
  JRadioButton Urgence3 = new JRadioButton();
  Panel panel9 = new Panel();
  Panel panel10 = new Panel();
  JLabel jLabel6 = new JLabel();
  JButton AllerEtage3 = new JButton();
  private Object JTextField1;
  JButton AllerEtage2 = new JButton();
  JButton AllerEtage1 = new JButton();
  JButton AllerEtage0 = new JButton();
  JButton Stop = new JButton();
  JButton Urgence = new JButton();
  private Object entree;

  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
        (getParameter(key) != null ? getParameter(key) : def);
  }

  //Construct the applet
  public Applet_Ascenseur() {
  }

  //Initialize the applet
  public void init() {
    try {
      jbInit();
      LireFichier();
    }

    catch (Exception e) {
      e.printStackTrace();
    }
  }

  //Component initialization
  private void jbInit() throws Exception {
    jLabel1.setFont(new java.awt.Font("Dialog", 3, 16));
    jLabel1.setForeground(Color.blue);
    jLabel1.setText("Étage de destination");
    this.setBackground(Color.white);
    this.setLayout(xYLayout1);
    jLabel2.setFont(new java.awt.Font("Dialog", 3, 16));
    jLabel2.setForeground(Color.blue);
    jLabel2.setText("Étage actuel");
    jLabel3.setFont(new java.awt.Font("Dialog", 3, 16));
    jLabel3.setForeground(Color.blue);
    jLabel3.setText("État des portes");
    jLabel4.setFont(new java.awt.Font("Dialog", 3, 16));
    jLabel4.setForeground(Color.blue);
    jLabel4.setText("État des voyants");
    jLabel5.setFont(new java.awt.Font("Dialog", 1, 18));
    jLabel5.setForeground(Color.red);
    jLabel5.setText("URGENCE");

    EtageDestination0.setBackground(Color.white);
    EtageDestination0.setEnabled(false);
    EtageDestination0.setText("Étage 0");
    EtageDestination1.setBackground(Color.white);
    EtageDestination1.setEnabled(false);
    EtageDestination1.setText("Étage 1");
    EtageDestination2.setBackground(Color.white);
    EtageDestination2.setEnabled(false);
    EtageDestination2.setText("Étage 2");
    EtageDestination3.setBackground(Color.white);
    EtageDestination3.setEnabled(false);
    EtageDestination3.setDoubleBuffered(false);
    EtageDestination3.setFocusPainted(true);
    EtageDestination3.setText("Étage 3");
    EtageActuel0.setBackground(Color.white);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setText("Étage 0");
    EtageActuel1.setBackground(Color.white);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setText("Étage 1");
    EtageActuel2.setBackground(Color.white);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setText("Étage 2");
    EtageActuel3.setBackground(Color.white);
    EtageActuel3.setEnabled(false);
    EtageActuel3.setText("Étage 3");
    panel1.setBackground(Color.black);
    PorteOuverte3.setBackground(Color.white);
    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setText("Ouverte");
    PorteFermee3.setBackground(Color.white);
    PorteFermee3.setEnabled(false);
    PorteFermee3.setText("Fermée");
    panel2.setBackground(Color.black);
    PorteOuverte2.setBackground(Color.white);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setText("Ouverte");
    PorteFermee2.setBackground(Color.white);
    PorteFermee2.setEnabled(false);
    PorteFermee2.setText("Fermée");
    PorteOuverte1.setBackground(Color.white);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setText("Ouverte");
    PorteFermee1.setBackground(Color.white);
    PorteFermee1.setEnabled(false);
    PorteFermee1.setText("Fermée");
    PorteOuverte0.setBackground(Color.white);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setText("Ouverte");
    PorteFermee0.setBackground(Color.white);
    PorteFermee0.setEnabled(false);
    PorteFermee0.setText("Fermée");
    panel3.setBackground(Color.black);
    panel4.setBackground(Color.black);
    panel5.setBackground(Color.black);
    VoyantAllume3.setBackground(Color.white);
    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setText("Allumé");
    VoyantEteint3.setBackground(Color.white);
    VoyantEteint3.setEnabled(false);
    VoyantEteint3.setText("Éteint");
    VoyantAllume2.setBackground(Color.white);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setText("Allumé");
    VoyantEteint2.setBackground(Color.white);
    VoyantEteint2.setEnabled(false);
    VoyantEteint2.setText("Éteint");
    VoyantAllume1.setBackground(Color.white);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setText("Allumé");
    VoyantEteint1.setBackground(Color.white);
    VoyantEteint1.setEnabled(false);
    VoyantEteint1.setText("Éteint");
    VoyantAllume0.setBackground(Color.white);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setText("Allumé");
    VoyantEteint0.setBackground(Color.white);
    VoyantEteint0.setEnabled(false);
    VoyantEteint0.setText("Éteint");
    panel6.setBackground(Color.black);
    panel7.setBackground(Color.black);
    panel8.setBackground(Color.black);
    Urgence1.setBackground(Color.white);
    Urgence1.setEnabled(false);
    Urgence1.setText("");
    Urgence2.setBackground(Color.white);
    Urgence2.setEnabled(false);
    Urgence2.setText("");
    Urgence3.setBackground(Color.white);
    Urgence3.setEnabled(false);
    Urgence3.setText("");
    panel9.setBackground(Color.lightGray);
    panel10.setBackground(Color.lightGray);
    xYLayout1.setWidth(708);
    xYLayout1.setHeight(450);
    jLabel6.setFont(new java.awt.Font("Dialog", 0, 10));
    jLabel6.setText("Choisissez l\'étage de destination");
    AllerEtage3.setSelected(false);
    AllerEtage3.setText("3");
    AllerEtage3.addMouseListener(new Applet_Ascenseur_AllerEtage3_mouseAdapter(this));
    AllerEtage2.setText("2");
    AllerEtage2.addMouseListener(new Applet_Ascenseur_AllerEtage2_mouseAdapter(this));
    AllerEtage1.setText("1");
    AllerEtage1.addMouseListener(new Applet_Ascenseur_AllerEtage1_mouseAdapter(this));
    AllerEtage0.setText("0");
    AllerEtage0.addMouseListener(new Applet_Ascenseur_AllerEtage0_mouseAdapter(this));
    Stop.setText("STOP");
    Stop.addMouseListener(new Applet_Ascenseur_Stop_mouseAdapter(this));
    Urgence.setText("URGENCE");
    Urgence.addMouseListener(new Applet_Ascenseur_Urgence_mouseAdapter(this));
    this.add(jLabel4, new XYConstraints(334, 166, 135, 36));
    this.add(jLabel3, new XYConstraints(170, 166, 123, 36));
    this.add(jLabel2, new XYConstraints(23, 166, 99, 35));
    this.add(jLabel1, new XYConstraints(145, 11, 163, 33));
    this.add(EtageDestination3, new XYConstraints(192, 54, -1, -1));
    this.add(EtageDestination0, new XYConstraints(192, 123, -1, -1));
    this.add(EtageDestination1, new XYConstraints(192, 100, -1, -1));
    this.add(EtageDestination2, new XYConstraints(192, 77, -1, -1));
    this.add(EtageActuel3, new XYConstraints(39, 218, -1, -1));
    this.add(EtageActuel0, new XYConstraints(39, 287, -1, -1));
    this.add(EtageActuel1, new XYConstraints(39, 264, -1, -1));
    this.add(EtageActuel2, new XYConstraints(39, 241, -1, -1));
    this.add(jLabel5, new XYConstraints(184, 357, 99, 39));
    this.add(Urgence2, new XYConstraints(219, 402, -1, -1));
    this.add(Urgence1, new XYConstraints(198, 402, -1, -1));
    this.add(Urgence3, new XYConstraints(240, 402, -1, -1));
    this.add(panel1, new XYConstraints(226, 215, 1, 100));
    this.add(PorteFermee3, new XYConstraints(226, 218, -1, -1));
    this.add(panel2, new XYConstraints(160, 241, 127, 1));
    this.add(PorteFermee2, new XYConstraints(226, 242, -1, -1));
    this.add(panel3, new XYConstraints(161, 265, 126, 1));
    this.add(PorteFermee1, new XYConstraints(227, 266, -1, -1));
    this.add(panel4, new XYConstraints(160, 289, 127, 1));
    this.add(PorteFermee0, new XYConstraints(227, 290, -1, -1));
    this.add(VoyantEteint3, new XYConstraints(405, 217, -1, -1));
    this.add(panel5, new XYConstraints(404, 216, 1, 97));
    this.add(panel6, new XYConstraints(346, 240, 110, 1));
    this.add(VoyantEteint2, new XYConstraints(405, 241, -1, -1));
    this.add(panel7, new XYConstraints(346, 264, 110, 1));
    this.add(VoyantEteint1, new XYConstraints(405, 265, -1, -1));
    this.add(panel8, new XYConstraints(346, 288, 111, 1));
    this.add(VoyantEteint0, new XYConstraints(405, 289, -1, -1));
    this.add(panel9, new XYConstraints(21, 151, 441, 7));
    this.add(panel10, new XYConstraints(19, 336, 441, 7));
    this.add(VoyantAllume3, new XYConstraints(342, 218, -1, -1));
    this.add(VoyantAllume2, new XYConstraints(342, 242, -1, -1));
    this.add(VoyantAllume1, new XYConstraints(342, 265, -1, -1));
    this.add(VoyantAllume0, new XYConstraints(342, 289, -1, -1));
    this.add(PorteOuverte3, new XYConstraints(156, 218, -1, -1));
    this.add(PorteOuverte2, new XYConstraints(156, 242, -1, -1));
    this.add(PorteOuverte1, new XYConstraints(155, 266, -1, -1));
    this.add(PorteOuverte0, new XYConstraints(156, 290, -1, -1));
    this.add(AllerEtage1,  new XYConstraints(600, 74, 41, 31));
    this.add(AllerEtage0,   new XYConstraints(643, 74, 43, 31));
    this.add(jLabel6, new XYConstraints(520, 22, 163, 37));
    this.add(Stop, new XYConstraints(564, 120, 78, 36));
    this.add(Urgence, new XYConstraints(536, 182, 142, 50));
    this.add(AllerEtage2, new XYConstraints(555, 74, 41, 31));
    this.add(AllerEtage3, new XYConstraints(508, 74, -1, 31));
  }

  //Start the applet
  public void start() {
  }

  //Stop the applet
  public void stop() {
  }

  //Destroy the applet
  public void destroy() {
  }

  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }

  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }

  /******************************************************************/
  /* classe permettant de gérer l'évènement du bouton "AllerEtage3" */
  /******************************************************************/
  class Applet_Ascenseur_AllerEtage3_mouseAdapter
      extends java.awt.event.MouseAdapter {
    Applet_Ascenseur adaptee;

    Applet_Ascenseur_AllerEtage3_mouseAdapter(Applet_Ascenseur adaptee) {
      this.adaptee = adaptee;
    }

    public void mouseClicked(MouseEvent e) {
      adaptee.AllerEtage3_mouseClicked(e);
    }
  }

  void AllerEtage3_mouseClicked(MouseEvent e) {
    EtageDestination3.setEnabled(true);
    EtageDestination3.setSelected(true);
    EtageActuel3.setEnabled(true);
    EtageActuel3.setSelected(true);
    PorteOuverte3.setEnabled(true);
    PorteOuverte3.setSelected(true);
    VoyantAllume3.setEnabled(true);
    VoyantAllume3.setSelected(true);

    EtageDestination2.setEnabled(false);
    EtageDestination2.setSelected(false);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setSelected(false);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setSelected(false);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setSelected(false);

    EtageDestination1.setEnabled(false);
    EtageDestination1.setSelected(false);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setSelected(false);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setSelected(false);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setSelected(false);

    EtageDestination0.setEnabled(false);
    EtageDestination0.setSelected(false);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setSelected(false);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setSelected(false);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setSelected(false);
  }

  /******************************************************************/
  /* classe permettant de gérer l'évènement du bouton "AllerEtage2" */
  /******************************************************************/
  class Applet_Ascenseur_AllerEtage2_mouseAdapter
     extends java.awt.event.MouseAdapter {
  Applet_Ascenseur adaptee;

  Applet_Ascenseur_AllerEtage2_mouseAdapter(Applet_Ascenseur adaptee) {
    this.adaptee = adaptee;
  }
  public void mouseClicked(MouseEvent e) {
    adaptee.AllerEtage2_mouseClicked(e);
  }
}

  void AllerEtage2_mouseClicked(MouseEvent e) {
    EtageDestination2.setEnabled(true);
    EtageDestination2.setSelected(true);
    EtageActuel2.setEnabled(true);
    EtageActuel2.setSelected(true);
    PorteOuverte2.setEnabled(true);
    PorteOuverte2.setSelected(true);
    VoyantAllume2.setEnabled(true);
    VoyantAllume2.setSelected(true);

    EtageDestination3.setEnabled(false);
    EtageDestination3.setSelected(false);
    EtageActuel3.setEnabled(false);
    EtageActuel3.setSelected(false);
    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setSelected(false);
    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setSelected(false);

    EtageDestination1.setEnabled(false);
    EtageDestination1.setSelected(false);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setSelected(false);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setSelected(false);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setSelected(false);

    EtageDestination0.setEnabled(false);
    EtageDestination0.setSelected(false);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setSelected(false);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setSelected(false);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setSelected(false);
  }

  /******************************************************************/
  /* classe permettant de gérer l'évènement du bouton "AllerEtage1" */
  /******************************************************************/
  class Applet_Ascenseur_AllerEtage1_mouseAdapter
      extends java.awt.event.MouseAdapter {
  Applet_Ascenseur adaptee;

  Applet_Ascenseur_AllerEtage1_mouseAdapter(Applet_Ascenseur adaptee) {
    this.adaptee = adaptee;
  }
  public void mouseClicked(MouseEvent e) {
    adaptee.AllerEtage1_mouseClicked(e);
  }
}

void AllerEtage1_mouseClicked(MouseEvent e) {
    EtageDestination1.setEnabled(true);
    EtageDestination1.setSelected(true);
    EtageActuel1.setEnabled(true);
    EtageActuel1.setSelected(true);
    PorteOuverte1.setEnabled(true);
    PorteOuverte1.setSelected(true);
    VoyantAllume1.setEnabled(true);
    VoyantAllume1.setSelected(true);

    EtageDestination3.setEnabled(false);
    EtageDestination3.setSelected(false);
    EtageActuel3.setEnabled(false);
    EtageActuel3.setSelected(false);
    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setSelected(false);
    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setSelected(false);

    EtageDestination2.setEnabled(false);
    EtageDestination2.setSelected(false);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setSelected(false);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setSelected(false);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setSelected(false);

    EtageDestination0.setEnabled(false);
    EtageDestination0.setSelected(false);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setSelected(false);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setSelected(false);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setSelected(false);
  }

  /******************************************************************/
  /* classe permettant de gérer l'évènement du bouton "AllerEtage0" */
  /******************************************************************/
  class Applet_Ascenseur_AllerEtage0_mouseAdapter extends java.awt.event.MouseAdapter {
  Applet_Ascenseur adaptee;

  Applet_Ascenseur_AllerEtage0_mouseAdapter(Applet_Ascenseur adaptee) {
    this.adaptee = adaptee;
  }
  public void mouseClicked(MouseEvent e) {
    adaptee.AllerEtage0_mouseClicked(e);
  }
}

  void AllerEtage0_mouseClicked(MouseEvent e) {
    EtageDestination0.setEnabled(true);
    EtageDestination0.setSelected(true);
    EtageActuel0.setEnabled(true);
    EtageActuel0.setSelected(true);
    PorteOuverte0.setEnabled(true);
    PorteOuverte0.setSelected(true);
    VoyantAllume0.setEnabled(true);
    VoyantAllume0.setSelected(true);

    EtageDestination3.setEnabled(false);
    EtageDestination3.setSelected(false);
    EtageActuel3.setEnabled(false);
    EtageActuel3.setSelected(false);
    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setSelected(false);
    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setSelected(false);

    EtageDestination2.setEnabled(false);
    EtageDestination2.setSelected(false);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setSelected(false);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setSelected(false);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setSelected(false);

    EtageDestination1.setEnabled(false);
    EtageDestination1.setSelected(false);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setSelected(false);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setSelected(false);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setSelected(false);
  }

  /***********************************************************/
  /* classe permettant de gérer l'évènement du bouton "Stop" */
  /***********************************************************/
  class Applet_Ascenseur_Stop_mouseAdapter
      extends java.awt.event.MouseAdapter {
    Applet_Ascenseur adaptee;

    Applet_Ascenseur_Stop_mouseAdapter(Applet_Ascenseur adaptee) {
      this.adaptee = adaptee;
    }

    public void mouseClicked(MouseEvent e) {
      adaptee.Stop_mouseClicked(e);
    }
  }

  void Stop_mouseClicked(MouseEvent e) {
    EtageDestination3.setEnabled(false);
    EtageDestination3.setSelected(false);
    EtageDestination2.setEnabled(false);
    EtageDestination2.setSelected(false);
    EtageDestination1.setEnabled(false);
    EtageDestination1.setSelected(false);
    EtageDestination0.setEnabled(false);
    EtageDestination0.setSelected(false);

    EtageActuel3.setEnabled(false);
    EtageActuel3.setSelected(false);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setSelected(false);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setSelected(false);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setSelected(false);

    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setSelected(false);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setSelected(false);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setSelected(false);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setSelected(false);

    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setSelected(false);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setSelected(false);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setSelected(false);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setSelected(false);
  }

  /**************************************************************/
  /* classe permettant de gérer l'évènement du bouton "Urgence" */
  /**************************************************************/
  class Applet_Ascenseur_Urgence_mouseAdapter
      extends java.awt.event.MouseAdapter {
    Applet_Ascenseur adaptee;

    Applet_Ascenseur_Urgence_mouseAdapter(Applet_Ascenseur adaptee) {
      this.adaptee = adaptee;
    }

    public void mouseClicked(MouseEvent e) {
      adaptee.Urgence_mouseClicked(e);
    }
  }

  void Urgence_mouseClicked(MouseEvent e) {
    Urgence1.setEnabled(true);
    Urgence1.setSelected(true);
    Urgence2.setEnabled(true);
    Urgence2.setSelected(true);
    Urgence3.setEnabled(true);
    Urgence3.setSelected(true);

    EtageDestination3.setEnabled(false);
    EtageDestination3.setSelected(false);
    EtageDestination2.setEnabled(false);
    EtageDestination2.setSelected(false);
    EtageDestination1.setEnabled(false);
    EtageDestination1.setSelected(false);
    EtageDestination0.setEnabled(false);
    EtageDestination0.setSelected(false);

    EtageActuel3.setEnabled(false);
    EtageActuel3.setSelected(false);
    EtageActuel2.setEnabled(false);
    EtageActuel2.setSelected(false);
    EtageActuel1.setEnabled(false);
    EtageActuel1.setSelected(false);
    EtageActuel0.setEnabled(false);
    EtageActuel0.setSelected(false);

    PorteOuverte3.setEnabled(false);
    PorteOuverte3.setSelected(false);
    PorteOuverte2.setEnabled(false);
    PorteOuverte2.setSelected(false);
    PorteOuverte1.setEnabled(false);
    PorteOuverte1.setSelected(false);
    PorteOuverte0.setEnabled(false);
    PorteOuverte0.setSelected(false);

    VoyantAllume3.setEnabled(false);
    VoyantAllume3.setSelected(false);
    VoyantAllume2.setEnabled(false);
    VoyantAllume2.setSelected(false);
    VoyantAllume1.setEnabled(false);
    VoyantAllume1.setSelected(false);
    VoyantAllume0.setEnabled(false);
    VoyantAllume0.setSelected(false);
  }
  public void LireFichier(){
    try {
      BufferedReader entree = new BufferedReader(new FileReader("EtatPOAscenseur.txt"));
      String LigneLue = entree.readLine();

      StringTokenizer tok = new StringTokenizer(LigneLue, ";");
      int nv = tok.countTokens();
      int i = nv;
      int x;
      int Tab[] = new int[i];
      for (i = 0; i < nv; i++) {
        x = Integer.parseInt(tok.nextToken());
        System.out.println(x);
        Tab[i] = x;
      }

      if (Tab[0] == 1) {
        EtageActuel0.setEnabled(true);
        EtageActuel0.setSelected(true);
      }
      else{
        EtageActuel0.setEnabled(false);
        EtageActuel0.setSelected(false);
      }

      if (Tab[1] == 1) {
        EtageActuel1.setEnabled(true);
        EtageActuel1.setSelected(true);
      }
      else{
        EtageActuel1.setEnabled(false);
        EtageActuel1.setSelected(false);
      }

      if (Tab[2] == 1) {
        EtageActuel2.setEnabled(true);
        EtageActuel2.setSelected(true);
      }
      else{
        EtageActuel2.setEnabled(false);
        EtageActuel2.setSelected(false);
      }

      if (Tab[3] == 1) {
        EtageActuel3.setEnabled(true);
        EtageActuel3.setSelected(true);
      }
      else{
        EtageActuel3.setEnabled(false);
        EtageActuel3.setSelected(false);
      }
    }
    catch (Exception erreur) {
      showStatus("[Erreur] Création : " + erreur.toString());
    }
  }
}




Cette discussion est classé dans : applet, page, valeur, viewer, html


Répondre à ce message

Sujets en rapport avec ce message

pb. : la page html me coupe le graphe que mon applet affiche [ par baziz ] Bonjour,j'arrive pas à afficher tout le contenu de mon applet dans la page html (le graphe qu'affiche l'applet est coupé au niveau de la limite de la Un applet java quiafficheune autre page [ par RazielReaver ] Bonjour à tous, Je suis nouveau sur ce forum. Voila je cherche un moyen de faire un cadre au millieu d'un tableau qui permetrais d'afficher un un autr Superposition d'une video et d'une applet dans une page HTML [ par devil02 ] Bonjour,Ce que je souhaiterais realiser c'est superposer a une video des informations comme une ligne d'horizon ou des coordonneés.c'est information j Applet UdpClient dans une page HTML [ par Dalton ] Bonjour,J'ai crée un applet UdpClient qui fonctionne correctement lorsque je le lance à partir de java (dans fenetre DOS, commande Java UdpClient)Lors Actualiser une applet dans une page html [ par alala ] Bonjour tt le monde!!! <IMG src="/imgs2/s Communication Applet - Html [ par thefxp17 ] Je lance mon applet dans ma page toto.htmla une moment mon applet lance une nouvelle page HTML grace àthis.getAppletContext().showDocument(myUrl,CL_FR ouvrir un page html avec un applet java [ par rstefr ] Bonjour à tous !Donc voila, je programme un applet sous JBuilder, et j'ai besoin que par un lien hypertexte, voire par un bouton, d'ouvrir une page in fermer page html [ par darkgenesis ] Bonsoir,je vous expose mon problème, j'ai fait 2 applets contenues dans 2 pages html différentes.au démarage je lance la premiere page html donc la pr inserer un applet dans une page html [ par limalima ] Bonjour à tous,j'ai crée un applet (FirstApplet)et une page html(h.htm)qui utilise cet applet:j'ai déplacé mon fichier FirstApplet.class dans mon bure Bouton qui réagit dans l'applet et ne réagit pas dans la page HTML [ par malbackt ] Bonsoir;j'ai implémenté une applet avec un bouton et un label , de telle sorte que lorsque je clique sur le bouton j'affiche une texte.Ceci marche trè


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,390 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.