Layout ManagerLayout Manager
Arranges the layout of window containing diffArranges the layout of window containing diff
controls.controls.
Default is the flow LayoutDefault is the flow Layout
setLayout() :setLayout() :
void setLayout(Layout Managervoid setLayout(Layout Manager
lyoutObj)lyoutObj)
Disable layout by passingDisable layout by passing nullnull for objectfor object
Component can be manually placed byComponent can be manually placed by
usingusing setBounds()setBounds()
minimumLayoutSize()minimumLayoutSize()
preferredLayoutSize()preferredLayoutSize()
Types of Layout ManagerTypes of Layout Manager
1. FlowLayout1. FlowLayout
2.BorderLayout2.BorderLayout
3. GridLayout3. GridLayout
4. CardLayout4. CardLayout
5. GridbagLayout5. GridbagLayout
FlowLayoutFlowLayout
 It is default flowlayoutIt is default flowlayout
 Implements simple layout styleImplements simple layout style
 Constructor are-Constructor are-
- FlowLayout()FlowLayout()
- FlowLayout(int how)FlowLayout(int how)
- FlowLayout(int how, int horz, int vert )FlowLayout(int how, int horz, int vert )
 Valid values for how-Valid values for how-
 FlowLayout.LEFTFlowLayout.LEFT
 FlowLayout.RIGHTFlowLayout.RIGHT
 FlowLayout.CENTERFlowLayout.CENTER
BorderLayoutBorderLayout
 The border layout has four narrow, fixed-The border layout has four narrow, fixed-
width components at the edges & 1 largewidth components at the edges & 1 large
area in the centerarea in the center
 Constructor of BorderLayout are-Constructor of BorderLayout are-
-BorderLayout()-BorderLayout()
-BorderLayout(int horz, int vert)-BorderLayout(int horz, int vert)
 Component can be used with add() methodComponent can be used with add() method
Void add(component compobj, ObjectVoid add(component compobj, Object
region)region)
BorderLayoutBorderLayout
 BorderLayout Defines certain regionBorderLayout Defines certain region
-BorderLayout.CENTER-BorderLayout.CENTER
-BorderLayout.SOUTH-BorderLayout.SOUTH
-BorderLayout.EAST-BorderLayout.EAST
-BorderLayout.WEST-BorderLayout.WEST
-BorderLayoutNORTH-BorderLayoutNORTH
GridLayoutGridLayout
 Used to layout Component in twoUsed to layout Component in two
dimensional griddimensional grid
 Need to define no. of rows & col.Need to define no. of rows & col.
 Constructors are-Constructors are-
--GridLayout ()GridLayout ()
- GridLayout(int noRows, int noCols)GridLayout(int noRows, int noCols)
- GridLayout(int noRows, int noCols, int horz, int vert)GridLayout(int noRows, int noCols, int horz, int vert)
CardLayoutCardLayout
 The CardLayout class manages the components inThe CardLayout class manages the components in
such a manner that only one component is visible atsuch a manner that only one component is visible at
a time. It treats each component as a card that isa time. It treats each component as a card that is
why it is known as CardLayout.why it is known as CardLayout.
 Constructor are-Constructor are-
 CardLayout( )CardLayout( )
 CardLayout(intCardLayout(int horz, int vert)horz, int vert)
 use this form of add( ) when adding cards to a paneluse this form of add( ) when adding cards to a panel
 void add(Componentvoid add(Component panelObj, Object name)panelObj, Object name)
CardLayoutCardLayout
Methods defined byMethods defined by CardLayoutCardLayout
 void first(Containervoid first(Container deck)deck)
 void last(Containervoid last(Container deck)deck)
 void next(Containervoid next(Container deck)deck)
 void previous(Containervoid previous(Container deck)deck)
 void show(Containervoid show(Container deck, String cardName)deck, String cardName)
GridbagLayoutGridbagLayout
 The class GridBagLayout arranges components inThe class GridBagLayout arranges components in
a horizontal and vertical manner Implements simplea horizontal and vertical manner Implements simple
layout stylelayout style
 each GridBagLayout object maintains a dynamic,each GridBagLayout object maintains a dynamic,
rectangular grid of cells, with each componentrectangular grid of cells, with each component
occupying one or more cellsoccupying one or more cells
 Constructor are-Constructor are-
 GridBagLayout()GridBagLayout()
 Method used to set constraintsMethod used to set constraints
-void setContsraints(Component-void setContsraints(Component
comp,Gridbagconstraints cns)comp,Gridbagconstraints cns)
GridbagLayoutGridbagLayout
Absolute ValuesAbsolute Values
 GridBagConstraints.NORTHGridBagConstraints.NORTH
GridBagConstraints.SOUTHGridBagConstraints.SOUTH
GridBagConstraints.WESTGridBagConstraints.WEST
GridBagConstraints.EASTGridBagConstraints.EAST
GridBagConstraints.NORTHWESTGridBagConstraints.NORTHWEST
GridBagConstraints.NORTHEASTGridBagConstraints.NORTHEAST
GridBagConstraints.SOUTHWESTGridBagConstraints.SOUTHWEST
GridBagConstraints.SOUTHEASTGridBagConstraints.SOUTHEAST
GridBagConstraints.CENTER (the default)GridBagConstraints.CENTER (the default)
GridbagLayoutGridbagLayout
Orientation Relative ValuesOrientation Relative Values
 GridBagConstraints.PAGE_STARTGridBagConstraints.PAGE_START
GridBagConstraints.PAGE_ENDGridBagConstraints.PAGE_END
GridBagConstraints.LINE_STARTGridBagConstraints.LINE_START
GridBagConstraints.LINE_ENDGridBagConstraints.LINE_END
GridBagConstraints.FIRST_LINE_STARTGridBagConstraints.FIRST_LINE_START
GridBagConstraints.FIRST_LINE_ENDGridBagConstraints.FIRST_LINE_END
GridBagConstraints.LAST_LINE_STARTGridBagConstraints.LAST_LINE_START
GridBagConstraints.LAST_LINE_ENDGridBagConstraints.LAST_LINE_END
GridbagLayoutGridbagLayout
Baseline Relative ValuesBaseline Relative Values
 GridBagConstraints.BASELINEGridBagConstraints.BASELINE
GridBagConstraints.BASELINE_LEADINGGridBagConstraints.BASELINE_LEADING
GridBagConstraints.BASELINE_TRAILINGGridBagConstraints.BASELINE_TRAILING
GridBagConstraints.ABOVE_BASELINEGridBagConstraints.ABOVE_BASELINE
GridBagConstraints.ABOVE_BASELINE_LEADINGGridBagConstraints.ABOVE_BASELINE_LEADING
GridBagConstraints.ABOVE_BASELINE_TRAILINGGridBagConstraints.ABOVE_BASELINE_TRAILING
GridBagConstraints.BELOW_BASELINEGridBagConstraints.BELOW_BASELINE
GridBagConstraints.BELOW_BASELINE_LEADINGGridBagConstraints.BELOW_BASELINE_LEADING
GridBagConstraints.BELOW_BASELINE_TRAILINGGridBagConstraints.BELOW_BASELINE_TRAILING

Javalayout

  • 1.
    Layout ManagerLayout Manager Arrangesthe layout of window containing diffArranges the layout of window containing diff controls.controls. Default is the flow LayoutDefault is the flow Layout setLayout() :setLayout() : void setLayout(Layout Managervoid setLayout(Layout Manager lyoutObj)lyoutObj) Disable layout by passingDisable layout by passing nullnull for objectfor object Component can be manually placed byComponent can be manually placed by usingusing setBounds()setBounds() minimumLayoutSize()minimumLayoutSize() preferredLayoutSize()preferredLayoutSize()
  • 2.
    Types of LayoutManagerTypes of Layout Manager 1. FlowLayout1. FlowLayout 2.BorderLayout2.BorderLayout 3. GridLayout3. GridLayout 4. CardLayout4. CardLayout 5. GridbagLayout5. GridbagLayout
  • 3.
    FlowLayoutFlowLayout  It isdefault flowlayoutIt is default flowlayout  Implements simple layout styleImplements simple layout style  Constructor are-Constructor are- - FlowLayout()FlowLayout() - FlowLayout(int how)FlowLayout(int how) - FlowLayout(int how, int horz, int vert )FlowLayout(int how, int horz, int vert )  Valid values for how-Valid values for how-  FlowLayout.LEFTFlowLayout.LEFT  FlowLayout.RIGHTFlowLayout.RIGHT  FlowLayout.CENTERFlowLayout.CENTER
  • 4.
    BorderLayoutBorderLayout  The borderlayout has four narrow, fixed-The border layout has four narrow, fixed- width components at the edges & 1 largewidth components at the edges & 1 large area in the centerarea in the center  Constructor of BorderLayout are-Constructor of BorderLayout are- -BorderLayout()-BorderLayout() -BorderLayout(int horz, int vert)-BorderLayout(int horz, int vert)  Component can be used with add() methodComponent can be used with add() method Void add(component compobj, ObjectVoid add(component compobj, Object region)region)
  • 5.
    BorderLayoutBorderLayout  BorderLayout Definescertain regionBorderLayout Defines certain region -BorderLayout.CENTER-BorderLayout.CENTER -BorderLayout.SOUTH-BorderLayout.SOUTH -BorderLayout.EAST-BorderLayout.EAST -BorderLayout.WEST-BorderLayout.WEST -BorderLayoutNORTH-BorderLayoutNORTH
  • 6.
    GridLayoutGridLayout  Used tolayout Component in twoUsed to layout Component in two dimensional griddimensional grid  Need to define no. of rows & col.Need to define no. of rows & col.  Constructors are-Constructors are- --GridLayout ()GridLayout () - GridLayout(int noRows, int noCols)GridLayout(int noRows, int noCols) - GridLayout(int noRows, int noCols, int horz, int vert)GridLayout(int noRows, int noCols, int horz, int vert)
  • 7.
    CardLayoutCardLayout  The CardLayoutclass manages the components inThe CardLayout class manages the components in such a manner that only one component is visible atsuch a manner that only one component is visible at a time. It treats each component as a card that isa time. It treats each component as a card that is why it is known as CardLayout.why it is known as CardLayout.  Constructor are-Constructor are-  CardLayout( )CardLayout( )  CardLayout(intCardLayout(int horz, int vert)horz, int vert)  use this form of add( ) when adding cards to a paneluse this form of add( ) when adding cards to a panel  void add(Componentvoid add(Component panelObj, Object name)panelObj, Object name)
  • 8.
    CardLayoutCardLayout Methods defined byMethodsdefined by CardLayoutCardLayout  void first(Containervoid first(Container deck)deck)  void last(Containervoid last(Container deck)deck)  void next(Containervoid next(Container deck)deck)  void previous(Containervoid previous(Container deck)deck)  void show(Containervoid show(Container deck, String cardName)deck, String cardName)
  • 9.
    GridbagLayoutGridbagLayout  The classGridBagLayout arranges components inThe class GridBagLayout arranges components in a horizontal and vertical manner Implements simplea horizontal and vertical manner Implements simple layout stylelayout style  each GridBagLayout object maintains a dynamic,each GridBagLayout object maintains a dynamic, rectangular grid of cells, with each componentrectangular grid of cells, with each component occupying one or more cellsoccupying one or more cells  Constructor are-Constructor are-  GridBagLayout()GridBagLayout()  Method used to set constraintsMethod used to set constraints -void setContsraints(Component-void setContsraints(Component comp,Gridbagconstraints cns)comp,Gridbagconstraints cns)
  • 10.
    GridbagLayoutGridbagLayout Absolute ValuesAbsolute Values GridBagConstraints.NORTHGridBagConstraints.NORTH GridBagConstraints.SOUTHGridBagConstraints.SOUTH GridBagConstraints.WESTGridBagConstraints.WEST GridBagConstraints.EASTGridBagConstraints.EAST GridBagConstraints.NORTHWESTGridBagConstraints.NORTHWEST GridBagConstraints.NORTHEASTGridBagConstraints.NORTHEAST GridBagConstraints.SOUTHWESTGridBagConstraints.SOUTHWEST GridBagConstraints.SOUTHEASTGridBagConstraints.SOUTHEAST GridBagConstraints.CENTER (the default)GridBagConstraints.CENTER (the default)
  • 11.
    GridbagLayoutGridbagLayout Orientation Relative ValuesOrientationRelative Values  GridBagConstraints.PAGE_STARTGridBagConstraints.PAGE_START GridBagConstraints.PAGE_ENDGridBagConstraints.PAGE_END GridBagConstraints.LINE_STARTGridBagConstraints.LINE_START GridBagConstraints.LINE_ENDGridBagConstraints.LINE_END GridBagConstraints.FIRST_LINE_STARTGridBagConstraints.FIRST_LINE_START GridBagConstraints.FIRST_LINE_ENDGridBagConstraints.FIRST_LINE_END GridBagConstraints.LAST_LINE_STARTGridBagConstraints.LAST_LINE_START GridBagConstraints.LAST_LINE_ENDGridBagConstraints.LAST_LINE_END
  • 12.
    GridbagLayoutGridbagLayout Baseline Relative ValuesBaselineRelative Values  GridBagConstraints.BASELINEGridBagConstraints.BASELINE GridBagConstraints.BASELINE_LEADINGGridBagConstraints.BASELINE_LEADING GridBagConstraints.BASELINE_TRAILINGGridBagConstraints.BASELINE_TRAILING GridBagConstraints.ABOVE_BASELINEGridBagConstraints.ABOVE_BASELINE GridBagConstraints.ABOVE_BASELINE_LEADINGGridBagConstraints.ABOVE_BASELINE_LEADING GridBagConstraints.ABOVE_BASELINE_TRAILINGGridBagConstraints.ABOVE_BASELINE_TRAILING GridBagConstraints.BELOW_BASELINEGridBagConstraints.BELOW_BASELINE GridBagConstraints.BELOW_BASELINE_LEADINGGridBagConstraints.BELOW_BASELINE_LEADING GridBagConstraints.BELOW_BASELINE_TRAILINGGridBagConstraints.BELOW_BASELINE_TRAILING

Editor's Notes

  • #3 MFC was introduced in 1992. VB created in 1991. Replaced by VB.NET. MS stopped supporting VB in 2005. ASP first developed in 1996. Used VBScript. “Write once, test everywhere.” – Hooks to OS or hardware specific devices means Java code must be changed.
  • #4 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #5 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #6 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #7 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #8 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #9 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #10 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #11 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #12 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?
  • #13 C#'s principal designer and lead architect at Microsoft is Anders Hejlsberg who also developed Turbo Pascal, Borland Delphi, and Visual J++. C++/CLI (Common Language Infrastructure) supersedes managed C++. It contains new syntax that helps clarify if using managed or unmanaged memory. http://en.wikipedia.org/wiki/C%2B%2B/CLI Managed vs. unmanaged code. What is the advantage of running managed code? Of running unmanaged code?