Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Synth L&F as jar

Thread view: 
derharri@web.de - 14 Aug 2006 11:24 GMT
Hello,

i am trying to build a L&F basedf on Synth but now i have problems
using the L&F in another project. I pack the L&F into jar add it to a
projects classpath but it is not possible to access the images
contained in the jar. I know that resources from a jar should be
accessed by:

MyResourceBase.class.getResource("path/relative/to/the/MyResourceBase.png")

the problem is that its not me who accesses the images but synth. AND
when i look into synths code the images should be loaded by:

new ImageIcon(url, null).getImage()
with url is the return of:
private URL getResource(String path) {
   return _resourceBase.getResource(path);
}

That looks correct to me but it does not work. Has anyone build his
synth L&F and got it to work from a jar? If that does not work, what is
a custom L&F good for if it can not be deployed as a jar?

I am very thankfull for all hints

Harri E.
Andrew Thompson - 14 Aug 2006 18:16 GMT
> Hello,
>
[quoted text clipped - 5 lines]
>
> MyResourceBase.class.getResource("path/relative/to/the/MyResourceBase.png")

Try..

MyResourceBase.class.getResource("/path/relative/to/the/MyResourceBase.png")

HTH

Andrew T.
derharri@web.de - 15 Aug 2006 12:46 GMT
Andrew Thompson schrieb:

> > Hello,
> >
[quoted text clipped - 13 lines]
>
> Andrew T.

no that was not the problem. The path does not have to start with a
slash. The problem was much more trivial. Accessing the files from the
jar reads the path case sensitive. Adapting the filenames solved the
problem.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.