Synth L&F as jar

Discussion in 'Java' started by derharri@web.de, Aug 14, 2006.

  1. Guest

    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.
     
    , Aug 14, 2006
    #1
    1. Advertising

  2. wrote:
    > 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")


    Try..

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

    HTH

    Andrew T.
     
    Andrew Thompson, Aug 14, 2006
    #2
    1. Advertising

  3. Guest

    Andrew Thompson schrieb:

    > wrote:
    > > 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")

    >
    > Try..
    >
    > MyResourceBase.class.getResource("/path/relative/to/the/MyResourceBase.png")
    >
    > HTH
    >
    > 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.
     
    , Aug 15, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    379
  2. Harri E

    Tooltip Problem with Synth

    Harri E, Sep 25, 2006, in forum: Java
    Replies:
    0
    Views:
    636
    Harri E
    Sep 25, 2006
  3. Guy_Sweden
    Replies:
    3
    Views:
    709
    Mike Treseler
    Oct 26, 2006
  4. Kgbol
    Replies:
    1
    Views:
    334
    Kgbol
    Jun 14, 2007
  5. hogcia
    Replies:
    0
    Views:
    606
    hogcia
    Apr 17, 2009
Loading...

Share This Page