java- graphical user interface (GUI) programming the AWT container -AWT

Original link: http://www.cnblogs.com/annewang/p/10042831.html

1, the container (Container)

  The container (Container) Component is a subclass of the container itself is thus a component, having all of the properties of the formation, the method can call all the Component class. Such as: size setting means to provide the Component class, location, visibility Method:

  1) setLocation (int x, int y): set position of the component

  2) setSize (int width, int height): Set the size of establishment

  3) setBounds (int x, int y, int width, int height): formation and set the size, position

  4) setVisible (Boolean b): Set visibility of the assembly

 

  The container may also be containing other components. Containers (Container) provides the following several methods used to access the component containers:

  1) Component add (Component comp): add additional components (the component may be a common component, the container may be) to the vessel, and return a component is added.

 

  AWT container is typically:

  (1) Panel, external manifestations of a rectangular region, side region can hold other components, the following features:

    1) can not exist, it must be placed in another vessel;

    2) for holding other components, to provide space for other components;

    3) Use FlowLayout layout manager by default.

  (2) ScrollPane, a scroll bar with the container, the following features:

    1) as the container can hold other components, when the assembly space is too large, automatically generated scrollbars the ScrollPane

    2) can not exist alone, it must be placed in other containers

    3) using the default layout manager BorderLayout

 

Reproduced in: https: //www.cnblogs.com/annewang/p/10042831.html

Guess you like

Origin blog.csdn.net/weixin_30215465/article/details/94858354