/** * Konstruktor MapView Aufgabe ist das Setzen der WorldMap und die Hintergrundgrafik (Landkarte) * zu setzen. * * @param worldMap Zum View gehoerige Instanz der Klasse WorldMap. */ public MapView(WorldMap worldMap) { this.worldMap = worldMap; this.territoryBattle = new ArrayList<Territory>(); this.setLayout(null); String path = System.getProperty("java.class.path") + "/risk/maps/" + worldMap.getGraphic(); // String path = "/home/swa/Desktop/maps/"+worldMap.getGraphic(); MediaTracker mt = new MediaTracker(this); this.img = Toolkit.getDefaultToolkit().getImage(path); mt.addImage(this.img, 0); try { mt.waitForAll(); } catch (InterruptedException e) { e.printStackTrace(); } this.setPreferredSize(new Dimension(img.getWidth(null), img.getHeight(null))); this.setVisible(true); }