Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class uk.co.ist.mwt.DrawingAreaLayout

java.lang.Object
  |
  +--uk.co.ist.mwt.MarginLayoutManager
        |
        +--uk.co.ist.mwt.DrawingAreaLayout
Subclasses:
BulletinBoardLayout

public class DrawingAreaLayout
extends MarginLayoutManager

The DrawingAreaLayout is a very simple layout manager - it leaves all child components where they want to be (that is, it doesn't move them), unless their position would put them inside the margin space.

If a child is added with no set size, then it will always be resized to its preferred size, even if the size is set later

It gives a minimum size of (2 * marginWidth, 2 * marginHeight) and a preferred size which makes all child components visible.

See Also:
Serialized Form

Constructor Summary
DrawingAreaLayout()
           
 
Method Summary
void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Add a component to the layout manager's records.
void layoutContainer(java.awt.Container parent)
          Lays out the container.
java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Find the minimum size for a paretn container with this layout.
java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Work out how large the parent Container should be to hold everthing comfortably.
void removeLayoutComponent(java.awt.Component comp)
          Remove a component from the layout manager's records.
 
Methods inherited from class uk.co.ist.mwt.MarginLayoutManager
addLayoutComponent, getMarginHeight, getMarginWidth, layoutContainer, minimumLayoutSize, preferredLayoutSize, removeLayoutComponent, setMarginHeight, setMarginWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

DrawingAreaLayout

public DrawingAreaLayout()
Method Detail

layoutContainer

public void layoutContainer(java.awt.Container parent)
Lays out the container. We need do nothing with any Components which have been moved and resized appropriately, but any which are sized to (0, 0) must be resized, as this is the default size for unlaid-out components.
Parameters:
parent - the component which needs to be laid out
Overrides:
layoutContainer in class MarginLayoutManager

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Find the minimum size for a paretn container with this layout. The DrawingAreaLayout has no problem with being resized to just enough size to hold its margins.
Parameters:
parent - the parent container
Overrides:
minimumLayoutSize in class MarginLayoutManager
See Also:
preferredLayoutSize

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Work out how large the parent Container should be to hold everthing comfortably. This is the size we need to be to be able to show everything, with margins.
Parameters:
parent - the parent container
Overrides:
preferredLayoutSize in class MarginLayoutManager
See Also:
minimumLayoutSize

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Remove a component from the layout manager's records. This is used to keep a record of components which were added with no explicit size setting made up-to-date.
Parameters:
comp - would be the component to remove.
Overrides:
removeLayoutComponent in class MarginLayoutManager
See Also:
addLayoutComponent

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Add a component to the layout manager's records. This would be used to keep a record of components which were added with no explicit size setting made up-to-date, but of course it's only called when a component is added with a name. So, the code to add unsized components to the list of such is in the updateUnsized() method, called from the layoutContainer() and preferred/minimumLayoutSize() methods.
Parameters:
comp - would be the component to add.
name - would be the name with which to add the component.
Overrides:
addLayoutComponent in class MarginLayoutManager
See Also:
removeLayoutComponent

Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD