🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #30057

�Por qu� no funciona este applet?

#30057
From: Sebasti�n Crespo Mezcua
Date: Fri, 29 Aug 1997 00:00
42 lines
1394 bytes
En el libro:

"Aprendiendo Java en 21 d�as" Prentice Hall

viene el ejemplo de un applet para mostrar un reloj digital en pantalla
. El c�digo es el siguiente:

import java.awt.Graphics;
import java.awt.Font;
import java.util.Date;

public class DigitalClock extends java.applet.Applet {

  Font theFont= new Font("TimesRoman",Font.BOLD,24);
  Date theDate;

  public void start(){

    while(true) {
      theDate= new Date();
      repaint();
      try{ Thread.sleep(1000);}
      catch (InterruptedException e){}
    }

  }

  public void paint(Graphics g){
    g.setFont(theFont);
    g.drawString(theDate.toString(),10,50);
  }

}

El problema est� en que al ejecutar el applet no aparece nada en
pantalla y quisiera que alguien me diese una explicaci�n de por qu�
ocurre esto porque en teor�a cuando se llama al m�todo repaint
este act�a llamando a su vez a paint y el reloj deber�a de aparecer 
en pantalla.

Gracias.
Technical Details
Message-ID: <3406E87C.401F@mx2.redestb.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: 1116f3,d0356b0864ff8faf,start
X-Google-Attributes: gid1116f3,public
From: Sebasti�n Crespo Mezcua <x5086329@mx2.redestb.es>
Subject: �Por qu� no funciona este applet?
Date: 1997/08/29
Message-ID: <3406E87C.401F@mx2.redestb.es>
X-Deja-AN: 268936943
Organization: ninguna
Reply-To: x5086329@mx2.redestb.es
Newsgroups: es.comp.lenguajes.java