starbuck86
Mitglied
Hallo zusammen.
Ich möchte eine Datei/Bild einlesen (Windows).
Problem:
Das Einlesen funktioniert nur, wenn im Pfad kein Leerzeichen ist, sonst kann er mir das Bild nicht anzeigen.
Hat jemand eine Idee?
Gruß
Thomas
PS: Ich benötige den absoluten Pfad!!
Ich möchte eine Datei/Bild einlesen (Windows).
Problem:
Das Einlesen funktioniert nur, wenn im Pfad kein Leerzeichen ist, sonst kann er mir das Bild nicht anzeigen.
Java:
private String pfad;
public void paint(Graphics g)
{
Image splashImage = getToolkit().getImage(getPath()+"splashscreen_op.jpg");
g.drawImage(splashImage, 0, 0, this);
}
public String getPath() {
if (this.pfad != null) {
return this.pfad;
} else {
String a = this.getClass().getResource(".").getFile().toString();
String c[] = a.split("/");
String d = "";
for (int i=0; i<=(c.length-1); i++) {
d += c[i]+"\\";
}
this.pfad = d;
return this.pfad;
}
}
Hat jemand eine Idee?
Gruß
Thomas
PS: Ich benötige den absoluten Pfad!!