🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Can I make an invisible control?

#1160
From: Gillmer J. Derge (TeamB)
Date: Fri, 19 Mar 2004 17:07
32 lines
2366 bytes
Ted Byers wrote:
> But here is another question about the use of JLabel within the designer.
> Is it possible to get it to load an image at design time?  Without that
> capability, it is rather hard to visually place my invisible JLabels.

The easiest way is to include the image file in your project.  It needs 
to be an explicit node in the project, not automatically discovered as 
part of the source tree.  For example,

1. Project | Add Files / Packages / Classes...
2. Browse to the file

Now you should be able to select that image in the designer as the value 
of the label's "icon" property.

If you don't want to clutter up the project with a lot of image files 
just for the sake of the designer, you can put them in a folder within 
the project.  For example,

1. Project | New Folder...
2. Name: images
3. Add the image files as nodes within the folder

The designer also picks up any ImageIcon's (probably any Icon) that's a 
member of your class.  For example, if I add this to my class, I can 
pick "icon1" as the value of a label's "icon" property.

   private ImageIcon icon1 = new 
ImageIcon(Untitled4.class.getResource("boot.gif"));

-- 
Gillmer J. Derge (TeamB)
Technical Details
Message-ID: <405b28d5$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <405b119a$1@newsgroups.borland.com> <405b1413$1@newsgroups.borland.com> <405b1da8$1@newsgroups.borland.com> <405b1f78$1@newsgroups.borland.com> <405b2349$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,713e84ee88d10114
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-03-19 09:10:39 PST
Date: Fri, 19 Mar 2004 12:07:36 -0500
From: "Gillmer J. Derge (TeamB)" <spam@gillmerderge.com>
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: Can I make an invisible control?
References: <405b119a$1@newsgroups.borland.com> <405b1413$1@newsgroups.borland.com> <405b1da8$1@newsgroups.borland.com> <405b1f78$1@newsgroups.borland.com> <405b2349$1@newsgroups.borland.com>
In-Reply-To: <405b2349$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 64.185.133.13
Message-ID: <405b28d5$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1079716053 64.185.133.13 (19 Mar 2004 09:07:33 -0800)
Lines: 32
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail