File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes AWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "AWT" Watch "AWT" New topic
Author

AWT

jeena jose
Ranch Hand

Joined: May 06, 2001
Posts: 69
Consider the following program...
import java.awt.*;
public class MyFrame
{
public static void main(String[] args)
{
Frame fr = new Frame();
Panel p = new Panel();
Button b1 = new Button("North");
p.add(b1);
Button b2 = new Button("South");
fr.add("North", p);
fr.add("South", b2);
fr.setSize(300,400);
fr.setVisible(true);
}
}
on resizing width of North will not change.why???
Sharada Kumaran
Greenhorn

Joined: May 23, 2001
Posts: 29
The buttons are added to the panel using FlowLayout (the default layout for Panels). FlowLayout honors the preferred size of the component, and will not resize the component even when its container changes size. The panel is added to the Frame using BorderLayout. On resizing the Frame, the panel might get resized, but the button in the panel is not affected. Infact, that is the primay advantage of adding components to a Panel, as opposed to adding it directly to the Frame.
Hope I could clear your doubt.
Sharada


Sharon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT
 
Similar Threads
Awt
BorderLayout question
for jqplus team
Jq + Question ID :970967626570
Auto Maximise GUI