Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doLayout() ....what calls that method?? 2

Status
Not open for further replies.

qb828

Programmer
Sep 27, 2000
98
US
Hi!

Can you help??
What calls the doLayout() method??

I looked but can't find any detail explanation.
Thank you for your help in advance.



QB
 
Thank you for your response.

I have an internalFrame and is resizable .
when the desktoppane is resized, does it call the
doLayout() automatically??

My understanding is that when the size of the desktopPane(which is borderLayout.Center) is changed,
it will call the doLayout() method automatically??

Am I right??
Where can I find this info on Sun Java API??
Please help!!
Thank you again.

QB
 
I already did..
found on doLayout() in container class.
not enough explaination.

That's why i am here to ask..
Thanks.

QB
 
The purpose of doLayout is to call the layout manager to rearrange/resize the components in the container. It does it automatically - you don't need to call it yourself, if that's what you mean.

So I would assume that if you see the layout "adjust" because of pane resizing, that doLayout was called.
 
Thanks millions idarke!!!

That was what I wanted to know.
I used a few print() statement and found out.
You were very helpful.

Thanks again.


QB
 
doLayout() is called by another method validate()
if you override validate() and do nothing, doLayout will not be called automatically.

import javax.swing.*;
import java.awt.*;
class testvalid extends JFrame
{
public testvalid()
{
super("testvalid");
getContentPane().setLayout(new GridLayout(3,1));
}
public void doLayout()
{
System.out.println("doLayout");
}
public void validate()
{
}
public static void main(String args[])
{
testvalid testvalidObj = new testvalid();
testvalidObj.setSize(400,400);
testvalidObj.pack();
testvalidObj.show();
}
}
 
prosper,
Thank you very much.
I didn't know that.
I learned another good trick.
Thanks a lot, prosper.

You Java forum MVPs are so great.


QB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top