🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1320

How to use images from up directories?

#1320
From: Rocket
Date: Tue, 06 Jan 2004 21:28
41 lines
1964 bytes
Hi, sorry my bad english,

I have problems with images and directories in JBuilder.

If I have an image in directory below from current directory, Jbuilder
create an code like this for an Icon:

jButton1.setIcon(new
ImageIcon(Frame1.class.getResource("img/myPicture.PNG")));

OK, it�s works... :-|

But, if I have the images in above directories, JBuilder creates a code like
this:

jButton.setIcon(new ImageIcon(new
java.net.URL("file:///C:/projects/mysystem/src/com/mycompany/myimages/myPict
ure.PNG")));

In other words, it put full path for the image.

My system like is:

package com.mycompany.mysystem.ihc
public class MyFrame extends JFrame {
...
}

...And the images are in package com.mycompany.myimages. (2 up�s
directories)

Using Design, the JBuilder creates an code like this:
...
jLabel1.setIcon(new ImageIcon(new
java.net.URL("file:///C:/projects/mysystem/src/com/mycompany/myimages/myPict
ure.PNG")));
...

Obviously, this code will not function at client...

How I use the Design (and configurate paths...) to create a correct code?
Technical Details
Message-ID: <3ffb2887$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,ed0e58961208387c,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-01-06 13:42:28 PST
From: "Rocket" <rocket@via.com.br>
Newsgroups: borland.public.jbuilder.java.swing
Subject: How to use images from up directories?
Date: Tue, 6 Jan 2004 19:28:39 -0200
Lines: 43
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 200.17.83.31
Message-ID: <3ffb2887$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1073424519 200.17.83.31 (6 Jan 2004 13:28:39 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail