๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7746

Re: new component

#7746
From: Nabin Thomas
Date: Tue, 22 May 2001 02:26
56 lines
2631 bytes
Instead of this try using a refrence to the Container.
Also check out whether the layout manager is set to null
(search for setLayout(null) )
If it is null then you may need to issue a setbounds call to the newly created
button.


facundo wrote:

> I'm writing my souce code in MouseClick event from another button.
> I've tried "this.getContentPane().add()"  but I still can't see my new
> button.
>
> rp <admin@objectpascal.com> escribiรณ en el mensaje de noticias
> 3b06ff09$1_1@dnews...
> > In your MouseListener the "this" reference will be pointing at your
> > MouseListener inner class or would that be your ActionListener? Is the
> > method name actionPerformed(ActionEvent e) ?
> > In anycase you need to add the button to a ContentPane
> > this.getContentPane().add() if you are not in an inner listener class.
> > and depending on the LayoutManager you may need to set prefered size, min
> > size, max size.
> >
> >
> >
> > "facundo" <fakkundo@hotmail.com> wrote in message news:3b054d39_1@dnews...
> > > How can I create a new component at run time?
> > > I've tried to writing this in MouseClick event of a button:
> > >
> > > JButton button2 = new JButton();
> > > this.add(button2);
> > >
> > > but I can't see the button, I think I'm missing something.
> > >
> > >
> >
> >

--
        ***********************************
***************************************************

Nabin Thomas

nabinthomas@hotmail.com

Feel free to contact me thru e-mail or MSN Mssenger
if required but DONOT SPAM

***************************************************
 ***********************************
Technical Details
Message-ID: <3B09CE3B.D918D817@hotmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b054d39_1@dnews> <3b06ff09$1_1@dnews> <3b091e7b_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,731295f9facb01cf
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-21 22:38:37 PST
Message-ID: <3B09CE3B.D918D817@hotmail.com>
Date: Tue, 22 May 2001 07:56:03 +0530
From: Nabin Thomas <nabinthomas@hotmail.com>
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: new component
References: <3b054d39_1@dnews> <3b06ff09$1_1@dnews> <3b091e7b_2@dnews>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 202.9.167.151
X-Trace: dnews 990508739 202.9.167.151 (21 May 2001 22:18:59 -0700)
Lines: 60
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews