URL imageURL = this.getClass().getClassLoader().getResource("images/sky.jpg");
Image image = toolkit.getImage(imageURL);
MediaTracker tracker = new MediaTracker(Cooja.getTopParentContainer());
tracker.addImage(image, 1);
try {
tracker.waitForAll();
} catch (InterruptedException ex) {
}
if (image.getHeight(Cooja.getTopParentContainer()) > 0 && image.getWidth(Cooja.getTopParentContainer()) > 0) {
image = image.getScaledInstance((200*image.getWidth(Cooja.getTopParentContainer())/image.getHeight(Cooja.getTopParentContainer())), 200, Image.SCALE_DEFAULT);
return new ImageIcon(image);