🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JDesktopPane problem

#601
From: John McGrath [TeamB]
Date: Wed, 16 Mar 2005 01:44
35 lines
2494 bytes
On 3/15/2005 at 2:45:10 AM, Lodhi wrote:

First, I should mention that when you include code in a post, it would
very helpful if you would format it reasonably.  Some newsreaders do not
handle tabs, so it is a good idea to untabify the code before you paste it
in.  If that does not work, you can just format it yourself in the message.

> try {
> //I did not have visiblity to this variable of Main class
> //  jdpDesktop.add(c, JLayeredPane.DEFAULT_LAYER);
> 
> //or I create new instance of JDesktopPane and do it 
> JDesktopPane jdp=new JDesktopPane();
>       jdp.add(c, JLayeredPane.DEFAULT_LAYER);

If you want to add a new JInternalFrame to the existing, instance of
JDesktopPane that is being displayed, then creating a new JDesktopPane
and adding it to that does not help.  You need to make sure you have
access to that existing instance.  One way to do this is to pass it an
argument in its constructor.

It would also make a lot more sense to write a single method to create the
new JInternalFrame.  Instead of placing that code in the ActionListener
for a menu item, extract that into a separate method which you call from
that ActionListener.  Then you can use the same method when you want to
create the frame from a different context.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <xn0dzsiv76oho9s002@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <42305ee7$1@newsgroups.borland.com> <xn0dzmx91zjs8b004@newsgroups.borland.com> <4236004b$1@newsgroups.borland.com> <xn0dzr0zc54jigu00c@newsgroups.borland.com> <42369286$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,585b4c91326488b0
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "John McGrath  [TeamB]" <ng-b@JPMcGrath.net>
Subject: Re: JDesktopPane problem
Newsgroups: borland.public.jbuilder.java.swing
References: <42305ee7$1@newsgroups.borland.com> <xn0dzmx91zjs8b004@newsgroups.borland.com> <4236004b$1@newsgroups.borland.com> <xn0dzr0zc54jigu00c@newsgroups.borland.com> <42369286$1@newsgroups.borland.com>
User-Agent: XanaNews/1.17.2.7
Message-ID: <xn0dzsiv76oho9s002@newsgroups.borland.com>
X-Ref: newsgroups.borland.com ~XNS:00000296
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
NNTP-Posting-Host: 151.201.155.159
Date: 15 Mar 2005 17:44:05 -0800
X-Trace: newsgroups.borland.com 1110937445 151.201.155.159 (15 Mar 2005 17:44:05 -0800)
Lines: 35
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail