Re: Loading icons out of a jar file

Frank Meissner <[email protected]> Fri, 17 Sep 2004 07:32:48 +0200
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Mathias Payer wrote:
> Hi there!
> I'm designing an application with the SWIXML Interface.
> The whole application will be packed into a jar file (eg. xyz.jar),
> shipped with the swixml and other jar files.
> The XML-File containing the user interface will also be in xyz.jar
> 
> In the program itself the XML-File is loaded with
> --SNIP--
> Container container =
> 	swix.render(this.getClass().getResource("StartUp.xml"));
> --SNAP--

Hello Mathias,

there is no need to render the xml file like this. Just put your 
StartUp.xml in your classpath and write it like this:
Container container = swix.render("StartUp.xml");

(I usally have a separated "resource" folder containing my 
SwixML-XML-files, icons and the like. This resource folder is put in the 
classpath.)

> 
> This XML-File contains some menu items and lots of other stuff.
> Now I'm wondering if it is possible to load the icons (specified in the
> XML File) also from a JAR file.
> e.g. from the directory ./icons relative in the xyz.jar File

Put your "icons" directory in your jar file and you are done. The same 
applies for your i18n-resources and the like. If you have the 
properties-files in some directory of your jar, mention the path in your 
"bundle" statement of the SwixMl-container.

Yours,

Frank

> 
> And the main question is, if it is possible, how to specify the
> --SNIP--
> icon="icons/new.gif"
> --SNAP--
> So that the icon is loaded from the JAR File.
> 
> Thanks in advance!
> 
> Sincerly yours
> Mathias Payer
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com