org.opensourcephysics.display
Class OSPLayout

java.lang.Object
  extended by java.awt.BorderLayout
      extended by org.opensourcephysics.display.OSPLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable

public class OSPLayout
extends java.awt.BorderLayout

A OSP layout lays out a container, arranging and resizing its components to fit in the corners or in one of the border layout regions.

Version:
1.0
Author:
W. Christian
See Also:
Serialized Form

Field Summary
static java.lang.String BOTTOM_LEFT_CORNER
          The bottom left corner layout constraint.
static java.lang.String BOTTOM_RIGHT_CORNER
          The bottom right layout constraint.
static java.lang.String CENTERED
          The bottom right layout constraint.
static int macOffset
           
static java.lang.String TOP_LEFT_CORNER
          The top left corner layout constraint.
static java.lang.String TOP_RIGHT_CORNER
          The top right corner layout constraint.
 
Fields inherited from class java.awt.BorderLayout
AFTER_LAST_LINE, AFTER_LINE_ENDS, BEFORE_FIRST_LINE, BEFORE_LINE_BEGINS, CENTER, EAST, LINE_END, LINE_START, NORTH, PAGE_END, PAGE_START, SOUTH, WEST
 
Constructor Summary
OSPLayout()
          Constructs a new OSP layout with no gaps between components.
OSPLayout(int hgap, int vgap)
          Constructs a new OSP layout with the specified gaps between components.
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
           
 void checkLayoutRect(java.awt.Container c, java.awt.Rectangle viewRect)
           
 java.awt.Component[] getComponents()
           
 void layoutContainer(java.awt.Container target)
          Lays out the container argument using this layout.
 boolean quickLayout(java.awt.Container target, java.awt.Component c)
          Lays out a single component by setting the component's bounds.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from this border layout.
 
Methods inherited from class java.awt.BorderLayout
addLayoutComponent, getConstraints, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getLayoutComponent, getLayoutComponent, getVgap, invalidateLayout, maximumLayoutSize, minimumLayoutSize, preferredLayoutSize, setHgap, setVgap, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

macOffset

public static int macOffset

TOP_LEFT_CORNER

public static final java.lang.String TOP_LEFT_CORNER
The top left corner layout constraint.

See Also:
Constant Field Values

TOP_RIGHT_CORNER

public static final java.lang.String TOP_RIGHT_CORNER
The top right corner layout constraint.

See Also:
Constant Field Values

BOTTOM_LEFT_CORNER

public static final java.lang.String BOTTOM_LEFT_CORNER
The bottom left corner layout constraint.

See Also:
Constant Field Values

BOTTOM_RIGHT_CORNER

public static final java.lang.String BOTTOM_RIGHT_CORNER
The bottom right layout constraint.

See Also:
Constant Field Values

CENTERED

public static final java.lang.String CENTERED
The bottom right layout constraint.

See Also:
Constant Field Values
Constructor Detail

OSPLayout

public OSPLayout()
Constructs a new OSP layout with no gaps between components.


OSPLayout

public OSPLayout(int hgap,
                 int vgap)
Constructs a new OSP layout with the specified gaps between components. The horizontal gap is specified by hgap and the vertical gap is specified by vgap.

Parameters:
hgap - the horizontal gap.
vgap - the vertical gap.
Method Detail

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object constraints)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
Overrides:
addLayoutComponent in class java.awt.BorderLayout

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from this border layout. This method is called when a container calls its remove or removeAll methods. Most applications do not call this method directly.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Overrides:
removeLayoutComponent in class java.awt.BorderLayout
Parameters:
comp - the component to be removed.
See Also:
Container.remove(java.awt.Component), Container.removeAll()

layoutContainer

public void layoutContainer(java.awt.Container target)
Lays out the container argument using this layout.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Overrides:
layoutContainer in class java.awt.BorderLayout
Parameters:
target - Container

quickLayout

public boolean quickLayout(java.awt.Container target,
                           java.awt.Component c)
Lays out a single component by setting the component's bounds.

Parameters:
target - Container

checkLayoutRect

public void checkLayoutRect(java.awt.Container c,
                            java.awt.Rectangle viewRect)

getComponents

public java.awt.Component[] getComponents()