T
terryl
Gast
Ich möchte ein Panel mit einem Hintergrundbild belegen.
Als Fehlermeldung erhalte ich bei Aufruf des Kostruktors PanelWithBG( String ):
Die Resource ist korrekt eingebunden, nur wird sie nicht als Protokoll akzeptiert. Wie kann ich sie umformen?
Code:
private URL oUrl = null;
/**
* @param oUrl
*/
public PanelWithBG( final URL oUrl )
{
super( true );
this.oUrl = oUrl;
}
/**
* @param sImgFile
*/
public PanelWithBG( final String sImgFile )
{
super( true );
try
{
this.oUrl = new URL( sImgFile ); // String: /de/projekt/res/background.png
}
catch( MalformedURLException e )
{
e.printStackTrace();
}
}
// ... (weiterer Code: überschriebene Paint-Methode)
Als Fehlermeldung erhalte ich bei Aufruf des Kostruktors PanelWithBG( String ):
Code:
java.net.MalformedURLException: no protocol: /de/projekt/res/background.png
Die Resource ist korrekt eingebunden, nur wird sie nicht als Protokoll akzeptiert. Wie kann ich sie umformen?