Diskuze: Načítání obrázků
Zobrazeno 4 zpráv z 4.
vlož to sem takto
použij tlačítko vložit zdrojový kód... zůstane formátování a líp se v tom hledá...
public class LoadImages {
static private BufferedImage blueBkg;
static private BufferedImage greenBkg;
static private BufferedImage newGame;
static private BufferedImage saveGame;
static private BufferedImage loadGame;
static private BufferedImage pause;
static private BufferedImage stop;
static private BufferedImage play;
static private BufferedImage ac;
static private BufferedImage dc;
static private BufferedImage vector;
public LoadImages() throws IOException {
URL urlBlueBkg = (this.getClass()).getResource("blue.png");
URL urlGreenBkg = (this.getClass()).getResource("green.png");
URL newG = (this.getClass()).getResource("newGame.png");
URL saveG = (this.getClass()).getResource("save.png");
URL loadG = (this.getClass()).getResource("load.png");
URL pausC = (this.getClass()).getResource("myPause.png");
URL stopC = (this.getClass()).getResource("stop.png");
URL playC = (this.getClass()).getResource("myPlay.png");
URL aC = (this.getClass()).getResource("ac.png");
URL dC = (this.getClass()).getResource("dc.png");
URL vectoR = (this.getClass()).getResource("vector.png");
try {
LoadImages.blueBkg = ImageIO.read(urlBlueBkg);
LoadImages.greenBkg = ImageIO.read(urlGreenBkg);
LoadImages.newGame = ImageIO.read(newG);
LoadImages.saveGame = ImageIO.read(saveG);
LoadImages.loadGame = ImageIO.read(loadG);
LoadImages.pause = ImageIO.read(pausC);
LoadImages.play = ImageIO.read(playC);
LoadImages.stop = ImageIO.read(stopC);
LoadImages.ac = ImageIO.read(aC);
LoadImages.dc = ImageIO.read(dC);
LoadImages.vector = ImageIO.read(vectoR);
} catch (IOException e) {
JOptionPane.showMessageDialog(new JFrame(), "Přidané soubory s obrázky nebyly nalezeny!");
System.exit(0);
}
}
}
Zobrazeno 4 zpráv z 4.