Package org.nuiton.jaxx.widgets.extra
Class GridFlowLayout
- java.lang.Object
-
- org.nuiton.jaxx.widgets.extra.GridFlowLayout
-
- All Implemented Interfaces:
LayoutManager,LayoutManager2
public class GridFlowLayout extends Object implements LayoutManager2
Ce layout place les composants de gauche à droite ou de droite à gauche selon la valeur deComponent.getComponentOrientation(). Si un composant n'a pas assez de place pour se mettre sur la ligne courant, il est mis sur la ligne suivante et les composants sont redimensionnés pour prendre le maximum de place disponible sur la ligne. Si le container est dans unJViewport(ouJScrollPane), ce layout essai de ne jamais faire apparaitre le ScrollBar horizontal.Tous les composants ont la même taille.
-
-
Constructor Summary
Constructors Constructor Description GridFlowLayout()GridFlowLayout constructor make a GridFlowLayout with default value (1) for gapGridFlowLayout(int hgap, int vgap)GridFlowLayout constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayoutComponent(Component comp, Object constraints)Method addLayoutComponentvoidaddLayoutComponent(String name, Component comp)Method addLayoutComponentComponent[]computeOrder(Component[] components)Method []protected intgetComponentVisibleCount(Container parent)Method getComponentVisibleCountNumbergetConstraints(Component comp)Method getConstraintsintgetHgap()Gets the horizontal gap between components.floatgetLayoutAlignmentX(Container target)Method getLayoutAlignmentXfloatgetLayoutAlignmentY(Container target)Method getLayoutAlignmentYprotected DimensiongetMaxWidthHeight(Container parent)Method getMaxWidthHeightprotected DimensiongetMinWidthHeight(Container parent)Method getMinWidthHeightintgetVgap()Gets the vertical gap between components.voidinvalidateLayout(Container target)Method invalidateLayoutvoidlayoutContainer(Container parent)Method layoutContainerstatic voidmain(String[] args)DimensionmaximumLayoutSize(Container target)Method maximumLayoutSizeDimensionminimumLayoutSize(Container parent)Method minimumLayoutSizeDimensionpreferredLayoutSize(Container parent)Method preferredLayoutSizevoidremoveLayoutComponent(Component comp)Method removeLayoutComponentvoidsetConstraints(Component comp, Number constraints)Method setConstraintsvoidsetHgap(int hgap)Sets the horizontal gap between components.voidsetVgap(int vgap)Sets the vertical gap between components.
-
-
-
Constructor Detail
-
GridFlowLayout
public GridFlowLayout()
GridFlowLayout constructor make a GridFlowLayout with default value (1) for gap
-
GridFlowLayout
public GridFlowLayout(int hgap, int vgap)GridFlowLayout constructor- Parameters:
hgap- the horizontal gap between two componentsvgap- the vertical gap between two components
-
-
Method Detail
-
getHgap
public int getHgap()
Gets the horizontal gap between components.- Returns:
- the horizontal gap between components
- See Also:
setHgap(int)
-
setHgap
public void setHgap(int hgap)
Sets the horizontal gap between components.- Parameters:
hgap- the horizontal gap between components- See Also:
getHgap()
-
getVgap
public int getVgap()
Gets the vertical gap between components.- Returns:
- the vertical gap between components
- See Also:
setVgap(int)
-
setVgap
public void setVgap(int vgap)
Sets the vertical gap between components.- Parameters:
vgap- the vertical gap between components- See Also:
getVgap()
-
addLayoutComponent
public void addLayoutComponent(Component comp, Object constraints)
Method addLayoutComponent- Specified by:
addLayoutComponentin interfaceLayoutManager2- Parameters:
comp- the component to addconstraints- a constraint which is a Number (position)
-
setConstraints
public void setConstraints(Component comp, Number constraints)
Method setConstraints- Parameters:
comp- the compoenentconstraints-
-
getConstraints
public Number getConstraints(Component comp)
Method getConstraints- Parameters:
comp-- Returns:
- a number that corresponding to the constraint
-
getLayoutAlignmentX
public float getLayoutAlignmentX(Container target)
Method getLayoutAlignmentX- Specified by:
getLayoutAlignmentXin interfaceLayoutManager2- Parameters:
target-- Returns:
- the X layout alignement
-
getLayoutAlignmentY
public float getLayoutAlignmentY(Container target)
Method getLayoutAlignmentY- Specified by:
getLayoutAlignmentYin interfaceLayoutManager2- Parameters:
target-- Returns:
- the Y layout alignement
-
invalidateLayout
public void invalidateLayout(Container target)
Method invalidateLayout- Specified by:
invalidateLayoutin interfaceLayoutManager2- Parameters:
target-
-
addLayoutComponent
public void addLayoutComponent(String name, Component comp)
Method addLayoutComponent- Specified by:
addLayoutComponentin interfaceLayoutManager- Parameters:
name-comp-
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
Method minimumLayoutSize- Specified by:
minimumLayoutSizein interfaceLayoutManager- Parameters:
parent-- Returns:
- the minimum dimension of the layout
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
Method preferredLayoutSize- Specified by:
preferredLayoutSizein interfaceLayoutManager- Parameters:
parent-- Returns:
- the preferred dimension of the layout
-
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
Method maximumLayoutSize- Specified by:
maximumLayoutSizein interfaceLayoutManager2- Parameters:
target-- Returns:
- the max dimension of the layout
-
removeLayoutComponent
public void removeLayoutComponent(Component comp)
Method removeLayoutComponent- Specified by:
removeLayoutComponentin interfaceLayoutManager- Parameters:
comp-
-
layoutContainer
public void layoutContainer(Container parent)
Method layoutContainer- Specified by:
layoutContainerin interfaceLayoutManager- Parameters:
parent-
-
getComponentVisibleCount
protected int getComponentVisibleCount(Container parent)
Method getComponentVisibleCount- Parameters:
parent-- Returns:
- an integer that corresponding to the number of visible components
-
getMaxWidthHeight
protected Dimension getMaxWidthHeight(Container parent)
Method getMaxWidthHeight- Parameters:
parent-- Returns:
- the max size
-
getMinWidthHeight
protected Dimension getMinWidthHeight(Container parent)
Method getMinWidthHeight- Parameters:
parent-- Returns:
- the dimension of this layout
-
computeOrder
public Component[] computeOrder(Component[] components)
Method []- Parameters:
components-- Returns:
- une tablean de composants contenus dans le layout
-
main
public static void main(String[] args)
-
-