F
F
fantua2014-04-19 20:03:47
Java
fantua, 2014-04-19 20:03:47

drawString not working when using Applet class

Hello.
It costs eclipse on Ubuntu 13. There is the following code:

package lab6;
import java.awt.*;
import java.applet.*;

public class Zvd_2 extends Applet {

  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  String sms;
  
  public void init() {
    setBackground(Color.black);
    setForeground(Color.red);
    sms = "метод init() -> ";
  }
  
  public void start() {
    sms += "метод start() -> ";
  }
  
  public void paint(Graphics g) {
    sms += " метод paint().";
    g.drawString(sms, 100, 300);
  }

}

The window should contain the contents of the sms variable. But I get this: i.piccy.info/i9/67dfaac626999d8cc15f908053df9947/1...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question