Valid XHTML    Valid CSS2    

Listing du fichier nbm3.txt

 

00001     import java.applet.*;
00002     import java.awt.*;
00003     import java.awt.event.*;
00004     
00005     public class nbm3a extends java.applet.Applet implements ActionListener {
00006     
00007      Label slt1 = new Label("Cliquer sur le bouton Ok !") ;
00008      Button bva3 = new Button(" Ok ") ;
00009      Label slt4 = new Label("") ;
00010     
00011      Panel lig1 = new Panel() ;
00012      Panel lig2 = new Panel() ;
00013      Panel lig3 = new Panel() ;
00014     
00015      public void init() {
00016     
00017      setLayout( new GridLayout(3,1)) ;
00018     
00019      add(lig1) ;
00020      lig1.add(slt1) ;
00021     
00022      add(lig2) ;
00023      lig2.add(bva3) ;
00024      bva3.addActionListener(this) ;
00025     
00026      add(lig3) ;
00027      lig3.add(slt4) ;
00028      slt4.setText(" vous n'avez pas encore appuyué.") ;
00029     
00030      } ; // fin de init
00031     
00032      public void actionPerformed(ActionEvent e) {
00033      slt4.setText(" Bravo, vous avez appuyé ! ") ;
00034      repaint() ;
00035      } ; // fin de actionPerformed
00036     
00037     
00038      } ; // fin de classe
00039     
00040     ===========================================================================================
00041     
00042     import java.applet.*;
00043     import java.awt.*;
00044     import java.awt.event.*;
00045     
00046     public class nbm3b extends java.applet.Applet implements ActionListener {
00047     
00048      Label slt1 = new Label("Cliquer sur le bouton Ok !") ;
00049      TextField pds2 = new TextField(10) ;
00050      Button bva3 = new Button(" Ok ") ;
00051      Label slt4 = new Label("") ;
00052     
00053      Panel lig1 = new Panel() ;
00054      Panel lig2 = new Panel() ;
00055      Panel lig3 = new Panel() ;
00056     
00057      public void init() {
00058     
00059      setLayout( new GridLayout(3,1)) ;
00060     
00061      add(lig1) ;
00062      lig1.add(slt1) ;
00063     
00064      add(lig2) ;
00065      lig2.add(pds2) ;
00066      pds2.setText(" 5 ") ;
00067      lig2.add(bva3) ;
00068      bva3.addActionListener(this) ;
00069     
00070      add(lig3) ;
00071      lig3.add(slt4) ;
00072      slt4.setText(" vous n'avez pas encore appuyué.") ;
00073     
00074      } ; // fin de init
00075     
00076      public void actionPerformed(ActionEvent e) {
00077      slt4.setText(" vous avez écrit "+pds2.getText() ) ;
00078      repaint() ;
00079      } ; // fin de actionPerformed
00080     
00081     
00082      } ; // fin de classe

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)