Java repaint() doesn't call the paint() in applet -


to clear, i've been researching more 5 hours now, read related questions , more 20 google searches, none of them worked me , none of them described case specifically.

first of here's code :

import java.util.*; import java.applet.*; import java.awt.*; import java.awt.image.*; import java.io.ioexception; import static debug.staticvar.*;  /* <applet code="imagetest" width=300 height=100> </applet> */  public class imagetest extends applet { image img; mediatracker tracker;  public void init() {     tracker = new mediatracker(this);     thread loader = new thread(() -> {         img = getimage(getcodebase(), "1.jpg");         tracker.addimage(img, 1);     });     loader.setpriority(10);     loader.start(); }  public void start() {     try {         tracker.waitforall();         repaint();     } catch (interruptedexception e) {     } }  public void paint(graphics g) {     g.drawimage(img, 0, 0, null); } } 

my problem repaint method not calling paint method. more specific paint method executes if call repaint thread, or if add paint method child class , call repaint doesn't work in code, directly call applet main thread. please heeeeelp, i'm tired


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -