View Single Post
Old 08-06-2005, 13:06   #3
Matrixbob
Senior Member
 
L'Avatar di Matrixbob
 
Iscritto dal: Jul 2001
Messaggi: 9947
Questo dovrebbe essere il bean.java:

Codice:
public class Rotator
{
       
       private String images[] = { "images/jhtp3.jpg",
          "images/xmlhtp1.jpg", "images/ebechtp1.jpg",
          "images/iw3htp1.jpg", "images/cpphtp3.jpg" };
           
       private String links[] = {
          "http://www.amazon.com/exec/obidos/ASIN/0130125075/" + 
             "deitelassociatin",
          "http://www.amazon.com/exec/obidos/ASIN/0130284173/" + 
             "deitelassociatin",
          "http://www.amazon.com/exec/obidos/ASIN/013028419X/" + 
             "deitelassociatin",
          "http://www.amazon.com/exec/obidos/ASIN/0130161438/" + 
             "deitelassociatin",
          "http://www.amazon.com/exec/obidos/ASIN/0130895717/" + 
             "deitelassociatin" };
            
      private int selectedIndex = 0;
   
      // returns image file name for current ad  
      public String getImage()
      {
         return images[ selectedIndex ];
      }
   
      // returns the URL for ad's corresponding Web site
      public String getLink()
      {
         return links[ selectedIndex ];
      }
   
      // update selectedIndex so next calls to getImage and 
      // getLink return a different advertisement
      public void nextAd()
      {
         selectedIndex = ( selectedIndex + 1 ) % images.length;
      }

}
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<<
Più largo è il sorriso, più affilato è il coltello.

Ultima modifica di Matrixbob : 21-06-2005 alle 17:29.
Matrixbob è offline   Rispondi citando il messaggio o parte di esso