🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
3 messages
3 total messages Started by J. Ebert Tue, 25 Mar 2003 11:08
How to include GIF in jar-file
#650
Author: J. Ebert
Date: Tue, 25 Mar 2003 11:08
19 lines
1530 bytes
Right now we use a nice gif to show if a checkbox is activated.
The code is very simple (and a prototyp):
    if ( IsFarbig ) {
      String dateiname = "c:\\cross_16mal18.gif";
      ImageIcon icon = new ImageIcon( dateiname );
      File f = new File( dateiname );
      if ( f.exists() && !Penabled && this.isSelected() ) {
        this.setIcon( icon );
      }
      else
        this.setIcon( null );
    }

I would like to have the gif in the jar-File that the archive
builder builds. And I do not know how to reference the gif when
it is not on the disk.

Anyone can help?
Re: How to include GIF in jar-file
#651
Author: Tor Iver Wilhelmsen (TeamB)
Date: Tue, 25 Mar 2003 11:39
8 lines
1284 bytes
"J. Ebert" <ebert@hhpv.de> writes:

> I would like to have the gif in the jar-File that the archive
> builder builds. And I do not know how to reference the gif when
> it is not on the disk.

It will be on the classpath, use
getClass().getResource("/theimage.gif")
Re: How to include GIF in jar-file
#652
Author: J. Ebert
Date: Tue, 25 Mar 2003 14:22
28 lines
1915 bytes
I got it to work with your hint, but still have a problem that
it only works when the gif is in two different locations in the
filesystem:
  src/images/my.gif
  src/de/xx/myclass/images/my.gif
I reference the gif with
    URL dateiname = getClass().getResource
         "/images/cross_16mal18.gif" );

The first location seems to be necessary in order to work
outside JBuilder. The second location to work within JBuilder.
The jar-file contains both gif's (what I don't like).

Any hint how the setup in JBuilder must be and where the gif 
is supposed to be in the filesystem??

Thank you, Jens

tor.wilhelmsen@ergo.no (Tor Iver Wilhelmsen (TeamB)) wrote:
>"J. Ebert" <ebert@hhpv.de> writes:
>
>> I would like to have the gif in the jar-File that the archive
>> builder builds. And I do not know how to reference the gif when
>> it is not on the disk.
>
>It will be on the classpath, use
>getClass().getResource("/theimage.gif")
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads