Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

get the value of the position of this JPanel inside the JFrame

1 réponse
Avatar
Frédéric Colombero
Hi Thomas,
What's the problem ?
I don't understand what you mean.
I have a JFrame and inside two JPanel one of them is on NORTH and the second
one is on the SOUTH.
And When I get the Container which is the JPanel (please see code below), I
would like to know if this one is in the north on the JFrame
or in the SOUTH or in the EAST, WEST or CENTER.
I would to know how to get the value of the position of this JPanel inside
the JFrame.
That 's all.
If you can helpme about this it will be very great.
Thanks a lot
Best regards
Frederic.

if (c instanceof JPanel){

String panel = "panel"+compPanel;

parentPanel = panel;

String allocPanel = ((Container)c).getClass().getName()+" "+panel+"= new
"+((Container)c).getClass().getName()+"();";

String namePanel = panel+".setName(\""+((Container)c).getName()+"\");";

//********** my proble is to do a array with the name of
BorderLayout.NORTH, etc...) *****//

String addPanel = allocPanel+"
this.getContentPane().add("+panel+","+borderLayout[compborderLayout]+");";

compborderLayout++;

compPanel++;

bodyProgram.append(addPanel+" "+namePanel);

sons = true;


--
Frédéric Colombero Presales/Consulting java Real Time
Phone: (33) 1 41 48 10 19 Fax: (33) 1 41 48 10 20
(33) 6 30 67 52 48
E-Mail: colombero@aonix.fr

1 réponse

Avatar
Patrick Ruzand
Salut,

"Frédéric Colombero" wrote in message
news:boa8r5$9ts$
Hi Thomas,
What's the problem ?
I don't understand what you mean.
I have a JFrame and inside two JPanel one of them is on NORTH and the
second

one is on the SOUTH.
And When I get the Container which is the JPanel (please see code below),
I

would like to know if this one is in the north on the JFrame
or in the SOUTH or in the EAST, WEST or CENTER.
I would to know how to get the value of the position of this JPanel inside
the JFrame.
That 's all.


Maitrises-tu toi-meme l'addition des composants ? Si oui, une solution
serait
de mettre en clientProperty de tes panel la contrainte du layout lors
de l'ajout du JPanel dans la JFrame. Ensuite, dans le code ci-dessous, tu
peux
recuperer cette clientProperty pour savoir la position du panel.

--
Patrick