🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Dialog box association

#1509
From: Lori M Olson (TeamB)
Date: Tue, 16 Dec 2003 16:37
41 lines
2662 bytes
Matthew Sweet wrote:

> That's the problem I'm having. Where I'm creating the dialog box I don't
> know how to get to the Frame class to pass it in.
> 
> I'm basically trying to create my own color chooser. Something simple with
> about 8 colors. I have my main frame that instantiates a class extending
> JPanel which in turn instantiates another class extending JPanel and from
> there instantiates the JDialog. I can't get to the Frame component from that
> last JPanel class to pass it into the JDialog class I created.
> 

There's a couple of ways to do this.

If you think this is going to be a common problem, and you need to have 
a way to access that Frame in many places... Then make a static public 
method that returns a reference to your frame in your application class 
- MyApplication.getFrame()

Or, if this is an isolated instance, then you can "walk" up the parent 
list of your panels, until you get to a parent that is instance of a 
JFrame, and use it.

-- 

Regards,

Lori Olson (TeamB)

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
     http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
     http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID: <3fdf342e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.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
References: <3fde2463@newsgroups.borland.com> <3fde265c$1@newsgroups.borland.com> <3fdf2537$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,55c92298dba121d1
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-12-16 08:42:11 PST
Date: Tue, 16 Dec 2003 09:37:19 -0700
From: "Lori M Olson (TeamB)" <javadragon@techie.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax; CDonDemand-Dom)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Re: Dialog box association
References: <3fde2463@newsgroups.borland.com> <3fde265c$1@newsgroups.borland.com> <3fdf2537$1@newsgroups.borland.com>
In-Reply-To: <3fdf2537$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 142.179.181.200
Message-ID: <3fdf342e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1071592494 142.179.181.200 (16 Dec 2003 08:34:54 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.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