View RSS Feed


AWT Layout

  1. Layout Managers and Containers

    by , 03-04-2012 at 05:26 PM
    A container must contain a layout manager to perform its work. If a layout manager is not associated with a container, the container will place the components wherever specified using following methods.
    A layout manager must be present in a container so that work could be performed. If container and layout manager are not associated with each other, the components will be placed by the container wherever specified by using these methods.

    1. setBounds()
    2. setSize()
    3. setLocation()
  2. GridBagLayout

    by , 03-04-2012 at 05:24 PM
    Components are arranged into grid of columns and rows by the GridBag Layout just the way grid layout manager did so. It also lets you to do the proper specification of the settings so that the components are positioned and sized in cells.

    It is not necessary for all components to be of one uniformed size. E.g. component’s position at grid can be changed or can be spanned to various columns & rows.

    Components present in longest row are used by the layout manager. ...
  3. GridLayout

    by , 03-04-2012 at 05:23 PM
    All components are arranged by the Grid layout manager. This arrangement is done in grid of columns and rows. One of the given options may be selected.
    • Number of columns & rows shall be specified.
    • Only rows are specified and no. of columns will be determined by the layout manager.
    • Just columns are specified and no. of rows will be determined by layout manager.

    Objects present in the layout manager grid have equal sizes which are based at the grid’s largest components. ...
    Tags: gridlayout Add / Edit Tags
  4. CardLayout

    by , 03-04-2012 at 12:12 PM
    Among number of component children, one container is displayed by the help of a card layout. This is similar to the flip cards present at your table. In a program, it can be used so that to show out various child component, to number of users.

    E.g. Interface might have different kind of functionality as shown to user in comparison with that interface which is displayed to administrator. Appropriate interfaces are shown by card layout’s help.

    Usage of the choice components ...
    Tags: cardlayout Add / Edit Tags
  5. FlowLayout

    by , 03-04-2012 at 12:09 PM
    Flow layout is considered as the default layout manager for all applets or panel objects. All components are placed by the flow layout in rows, totally in accordance with panel’s width & size or total no. of components.
    Resizing of the windows shall be done to understand fully the flow layout. It will show you that how from one row, components will float to other.

    Flow layout is given as following.

    Name:  1.JPG
Views: 379
Size:  22.5 KB
    Tags: flowlayout Add / Edit Tags
  6. BorderLayout

    by , 03-04-2012 at 11:52 AM
    Border Layout is for all objects of window’s default layout. There are 5 fixed areas of it, which are:
    1. North
    2. West
    3. Center
    4. South
    5. East

    For container, this given figure illustrates the border layout that has been implemented.
    • In north area, Border Layout Label is present.
    • In the South area, Ok button is present.
    • In the Center area, FRUIT trees list is present.
    • Empty east area.
    • Empty West area. ...
    Tags: borderlayout Add / Edit Tags
  7. List of Layout Managers

    by , 03-04-2012 at 11:49 AM
    Pre-defined entire layout manager is present in java.awt. Interface java.awt.LayoutManager is implemented by the layout manager.

    Every AWT i.e Abstract Windows Toolkit & swing container consists of a pre-defined default layout manager.
    • container.setLayout can be used for setting or changing the layout manager.
    • Interface java.awt.LayoutManager is implemented for customized layout manager.

    Layout managers that are pre-defined are given here:
    • java.awt.BorderLayout
    • java.awt.FlowLayout
    • java.awt.CardLayout
    • java.awt.GridLayout
    • java.awt.GridBagLayout
  8. What is a Layout Manager?

    by , 03-04-2012 at 11:48 AM
    Layout manager is considered responsible for controlling the size or position of those components which are present in container object. E.g, different components (like buttons & labels) are present in window container. Components present in windows are Positioned and re-sized by layout manager.

    One container may possess other container in it. Like, one container window may contain container panel. Given figure shows the purposes of layout manager.

    1. Resizing ...