Package org.nuiton.jaxx.widgets.extra
Class GridFlowLayout
java.lang.Object
org.nuiton.jaxx.widgets.extra.GridFlowLayout
- All Implemented Interfaces:
java.awt.LayoutManager,java.awt.LayoutManager2
public class GridFlowLayout
extends java.lang.Object
implements java.awt.LayoutManager2
Ce layout place les composants de gauche à droite ou de droite à gauche selon
la valeur de
Component.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 un
JViewport (ou JScrollPane), ce layout
essai de ne jamais faire apparaitre le ScrollBar horizontal.
Tous les composants ont la même taille.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.awt.Component,java.lang.Object>positions -
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
Modifier and Type Method Description voidaddLayoutComponent(java.awt.Component comp, java.lang.Object constraints)Method addLayoutComponentvoidaddLayoutComponent(java.lang.String name, java.awt.Component comp)Method addLayoutComponentjava.awt.Component[]computeOrder(java.awt.Component[] components)Method []protected intgetComponentVisibleCount(java.awt.Container parent)Method getComponentVisibleCountjava.lang.NumbergetConstraints(java.awt.Component comp)Method getConstraintsintgetHgap()Gets the horizontal gap between components.floatgetLayoutAlignmentX(java.awt.Container target)Method getLayoutAlignmentXfloatgetLayoutAlignmentY(java.awt.Container target)Method getLayoutAlignmentYprotected java.awt.DimensiongetMaxWidthHeight(java.awt.Container parent)Method getMaxWidthHeightprotected java.awt.DimensiongetMinWidthHeight(java.awt.Container parent)Method getMinWidthHeightintgetVgap()Gets the vertical gap between components.voidinvalidateLayout(java.awt.Container target)Method invalidateLayoutvoidlayoutContainer(java.awt.Container parent)Method layoutContainerstatic voidmain(java.lang.String[] args)java.awt.DimensionmaximumLayoutSize(java.awt.Container target)Method maximumLayoutSizejava.awt.DimensionminimumLayoutSize(java.awt.Container parent)Method minimumLayoutSizejava.awt.DimensionpreferredLayoutSize(java.awt.Container parent)Method preferredLayoutSizevoidremoveLayoutComponent(java.awt.Component comp)Method removeLayoutComponentvoidsetConstraints(java.awt.Component comp, java.lang.Number constraints)Method setConstraintsvoidsetHgap(int hgap)Sets the horizontal gap between components.voidsetVgap(int vgap)Sets the vertical gap between components.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
positions
protected java.util.Map<java.awt.Component,java.lang.Object> positions
-
-
Constructor Details
-
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 Details
-
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(java.awt.Component comp, java.lang.Object constraints)Method addLayoutComponent- Specified by:
addLayoutComponentin interfacejava.awt.LayoutManager2- Parameters:
comp- the component to addconstraints- a constraint which is a Number (position)
-
setConstraints
public void setConstraints(java.awt.Component comp, java.lang.Number constraints)Method setConstraints- Parameters:
comp- the compoenentconstraints-
-
getConstraints
public java.lang.Number getConstraints(java.awt.Component comp)Method getConstraints- Parameters:
comp-- Returns:
- a number that corresponding to the constraint
-
getLayoutAlignmentX
public float getLayoutAlignmentX(java.awt.Container target)Method getLayoutAlignmentX- Specified by:
getLayoutAlignmentXin interfacejava.awt.LayoutManager2- Parameters:
target-- Returns:
- the X layout alignement
-
getLayoutAlignmentY
public float getLayoutAlignmentY(java.awt.Container target)Method getLayoutAlignmentY- Specified by:
getLayoutAlignmentYin interfacejava.awt.LayoutManager2- Parameters:
target-- Returns:
- the Y layout alignement
-
invalidateLayout
public void invalidateLayout(java.awt.Container target)Method invalidateLayout- Specified by:
invalidateLayoutin interfacejava.awt.LayoutManager2- Parameters:
target-
-
addLayoutComponent
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)Method addLayoutComponent- Specified by:
addLayoutComponentin interfacejava.awt.LayoutManager- Parameters:
name-comp-
-
minimumLayoutSize
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)Method minimumLayoutSize- Specified by:
minimumLayoutSizein interfacejava.awt.LayoutManager- Parameters:
parent-- Returns:
- the minimum dimension of the layout
-
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)Method preferredLayoutSize- Specified by:
preferredLayoutSizein interfacejava.awt.LayoutManager- Parameters:
parent-- Returns:
- the preferred dimension of the layout
-
maximumLayoutSize
public java.awt.Dimension maximumLayoutSize(java.awt.Container target)Method maximumLayoutSize- Specified by:
maximumLayoutSizein interfacejava.awt.LayoutManager2- Parameters:
target-- Returns:
- the max dimension of the layout
-
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)Method removeLayoutComponent- Specified by:
removeLayoutComponentin interfacejava.awt.LayoutManager- Parameters:
comp-
-
layoutContainer
public void layoutContainer(java.awt.Container parent)Method layoutContainer- Specified by:
layoutContainerin interfacejava.awt.LayoutManager- Parameters:
parent-
-
getComponentVisibleCount
protected int getComponentVisibleCount(java.awt.Container parent)Method getComponentVisibleCount- Parameters:
parent-- Returns:
- an integer that corresponding to the number of visible components
-
getMaxWidthHeight
protected java.awt.Dimension getMaxWidthHeight(java.awt.Container parent)Method getMaxWidthHeight- Parameters:
parent-- Returns:
- the max size
-
getMinWidthHeight
protected java.awt.Dimension getMinWidthHeight(java.awt.Container parent)Method getMinWidthHeight- Parameters:
parent-- Returns:
- the dimension of this layout
-
computeOrder
public java.awt.Component[] computeOrder(java.awt.Component[] components)Method []- Parameters:
components-- Returns:
- une tablean de composants contenus dans le layout
-
main
public static void main(java.lang.String[] args)
-