MediaTracker - how to use it, what are the benefits, or is there an alterative?
问题 In the codebase we inherited the usage of MediaTracker was always done locally in each code block. new MediaTracker(new Canvas()); mediatracker.addImage(i, 1); try { mediatracker.waitForAll(); } catch (InterruptedException e) { } mediatracker.removeImage(i); Deciding this was inefficient, I eventually replaced it with a static instance and method: final static protected MediaTracker mediatracker = new MediaTracker(new Canvas()); static protected void checkImageIsReady(Image i) { mediatracker