Java LayOut Tools B.N Veren Deepak - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Java LayOut Tools B.N Veren Deepak

Description:

Is the Object that determines manner in which components are arranged in ... 7. top inset, left inset, bottom inset, right inset External padding of the part. ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 13
Provided by: cb2
Category:
Tags: layout | deepak | inset | java | tools | veren

less

Transcript and Presenter's Notes

Title: Java LayOut Tools B.N Veren Deepak


1
Java LayOut Tools B.N Veren Deepak
  • Flow Layout
  • Border Layout
  • Card Layout
  • Grid Bag
  • Grid

2
GUI Designer should
  • Know Users and their needs
  • Prevent errors
  • Make information readily available
  • Optimise User abilities
  • Consistent with placement of colour shemes and
    components

3
LayOut Manager
  • Is the Object that determines manner in which
    components are arranged in container
  • Java standard Class libraries predefined Layout
    managers are
  • Flow LayOut, Border, Card, Grid, GridBag Layout
    defined in the AWT.
  • Order Layout in the Swing.
  • Extended layouts are additional layout managers
    included with simplicity professional.

4
Layout manager
  • Each layout managers has own rules governing how
    the components will be arranged
  • Some layout managers pay attention to a
  • component's preferred size or alignment
  • A layout manager attempts to vary layout as
    components are added and as containers are
    resized
  • We can assign layout manager for a container
    however every container has a layout manger by
    default.

5
Flow Layout
  • Puts as many components possible on row and moves
    to next row
  • Rows are created as needed to accomadate all of
    components
  • Components are displayed order in which they are
    added to container

6
Flow layout
  • Each button is made large enough to accommodate
    its label
  • Components can be left aligned, right aligned or
    centred.
  • Horizontal and vertical lines can be explicitly
    set.

7
Border Layout
  • This layout can hold upto five parts arranged in
    north, south, east and west.
  • Each area displays one component just as another
    container like Jpanel
  • Each of four areas enlarges as components are
    added to it.
  • Centre area expands to fill space as needed
  • Nothing added to outer areas they take no space
    and others expand to fill gap void.
  • Holds five empty spaces, when done with adding
    parts spaces can be deleted by unchecking show
    empty panels check box

8
Grid layout
  • Presents a containers components in rectangular
    grid of rows and columns.
  • One component is placed in each cell of grid and
    all cells have same size.
  • Size of each cell is determined by the overall
    size of container
  • Components are added from top to bottom and left
    to right on each row.
  • Grid layout hold rowscolumns empty spaces
  • Remaining empty spaces are removed by unchecking
    show empty panels checkbox.
  • Grid dimensions are diminished empty spaces are
    removed from bottom and right.
  • Parts sitting in these spaces removed to
    Recycling bin

9
Box layout
  • Organises components either horizontally in one
    row or vertically in one column
  • By combing multiple containers using box layout
    different configurations can be created
  • New Boxlayout object must be created for each
    component
  • Multiple containers with box layouts are often
    preferred to one container that uses more
    complicated Gridbag layout manager
  • Components are placed top to bottom or left to
    right based on arrival
  • To fill up space between components invisible
    components are added
  • Rigid area is created using createRigidArea
    method of box class.
  • Glue is created using createHorizontalGlue or
    create verticaGluemethods

10
Grid bag Layout
  • Most flexible and versatile among AWT layout
    managers.
  • Once set of parts have been added user can
    specify set of constraints to be applied to each
    part and how parts should be laid out respect to
    each other
  • Starts with single empty single space, user can
    add or remove empty spaces or change order of
    parts using properties.

11
Grid bag layout contd..
  • Grid bag constraints are
  • 1. gridx, gridy The part's position in the grid.
  • 2. width, height The number of rows and columns
    the part should occupy.
  • 3.anchor A part can be anchored to any side of
    its cell. The user can choose a value by clicking
    the mouse in the grid in the appropriate table
    cell.
  • 4. fill How the part should expand to fill extra
    space. The possible values are none, horizontal,
    vertical, and both. The user can cycle through
    these values by clicking the mouse on the
    appropriate table cell.
  • 5. xweight, yweight Specifies how extra space
    should be distributed among parts.
  • 6. x internal..., y internal... Internal padding
    of the part.
  • 7. top inset, left inset, bottom inset, right
    inset External padding of the part.

12
Extended Layouts
  • Tabbed card layout
  • Left side layout
  • Right side layout
  • Bottom layout
  • Top layout
  • Scroll panel layout
  • Absolute layout
Write a Comment
User Comments (0)
About PowerShow.com