Article View: borland.public.jbuilder.java.language
Article #7859Re: new component
From: rp
Date: Sat, 19 May 2001 23:15
Date: Sat, 19 May 2001 23:15
20 lines
1580 bytes
1580 bytes
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. > >
Technical Details
Message-ID:
<3b06ff09$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.usenet-edu.net!usenet-edu.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b054d39_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,731295f9facb01cf X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-19 16:39:46 PST From: "rp" <admin@objectpascal.com> Newsgroups: borland.public.jbuilder.java.language References: <3b054d39_1@dnews> Subject: Re: new component Date: Sat, 19 May 2001 18:15:10 -0500 Lines: 22 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 64.132.9.22 Message-ID: <3b06ff09$1_1@dnews> X-Trace: dnews 990314249 64.132.9.22 (19 May 2001 16:17:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.usenet-edu.net!usenet-edu.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews