Valid XHTML    Valid CSS2    

Listing du fichier nbm2.java

 

00001      import java.applet.*;
00002      import java.awt.*;
00003     
00004      public class nbm2 extends java.applet.Applet {
00005     
00006      Font maf ;
00007      String txt = " Bonsoir " ;
00008      int taille = 14 ;
00009      int lenbm ;
00010      Label titre ;
00011     
00012      public static int entierAuHasard( int vmin, int vmax) {
00013      return (int) (vmin + Math.random()*(vmax-vmin)) ;
00014      } // fin de entierAuHasard
00015     
00016      public void init() {
00017      setBackground(Color.lightGray) ;
00018      maf = new Font("Helvetica",Font.BOLD,taille) ;
00019      lenbm = entierAuHasard(100,500) ;
00020      titre = new Label(" le nombre mystérieux est "+lenbm) ;
00021      add(titre) ;
00022      } ; // fin de init
00023     
00024      } ; // 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)