Re: Components in JPanel
- From: "Rhino" <no.offline.contact.please@xxxxxxxxxx>
- Date: Tue, 28 Mar 2006 19:07:04 -0500
"Carl" <c.groner@xxxxxxxxx> wrote in message
news:1143588725.125176.137160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello Nandu,If I remember correctly, getName() returns a blank (or null) if you call it
My reply is inline...
Nandu wrote:
Hi
I am placing JLabels, JButtons , JRadioButtons and other components
on the JPanel at random. Now how can i know what are components are
there in the JPanel at a instance of time.
The Container.getComponents() method will retrive an array of all
Component objects in the Container.
How can get their names. For
example if btn_Hello is a JButton and if it is on the JPanel then i
should be able to get btn_Hello is on the JPanel.
How about the getName() method of Component objects?
without first using setName() to give the component a name. So, you will
want to make a point of giving the component a name with setName() when you
create it, e.g. setName("my first button").
--
Rhino
.
- Follow-Ups:
- Re: Components in JPanel
- From: Nandu
- Re: Components in JPanel
- References:
- Components in JPanel
- From: Nandu
- Re: Components in JPanel
- From: Carl
- Components in JPanel
- Prev by Date: Re: Components in JPanel
- Next by Date: Re: auto-detecting the character set encoding of a text file
- Previous by thread: Re: Components in JPanel
- Next by thread: Re: Components in JPanel
- Index(es):
Relevant Pages
|