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 void
addLayoutComponent(Component comp, Object constraints)
Method addLayoutComponentvoid
addLayoutComponent(String name, Component comp)
Method addLayoutComponentComponent[]
computeOrder(Component[] components)
Method []protected int
getComponentVisibleCount(Container parent)
Method getComponentVisibleCountNumber
getConstraints(Component comp)
Method getConstraintsint
getHgap()
Gets the horizontal gap between components.float
getLayoutAlignmentX(Container target)
Method getLayoutAlignmentXfloat
getLayoutAlignmentY(Container target)
Method getLayoutAlignmentYprotected Dimension
getMaxWidthHeight(Container parent)
Method getMaxWidthHeightprotected Dimension
getMinWidthHeight(Container parent)
Method getMinWidthHeightint
getVgap()
Gets the vertical gap between components.void
invalidateLayout(Container target)
Method invalidateLayoutvoid
layoutContainer(Container parent)
Method layoutContainerstatic void
main(String[] args)
Dimension
maximumLayoutSize(Container target)
Method maximumLayoutSizeDimension
minimumLayoutSize(Container parent)
Method minimumLayoutSizeDimension
preferredLayoutSize(Container parent)
Method preferredLayoutSizevoid
removeLayoutComponent(Component comp)
Method removeLayoutComponentvoid
setConstraints(Component comp, Number constraints)
Method setConstraintsvoid
setHgap(int hgap)
Sets the horizontal gap between components.void
setVgap(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:
addLayoutComponent
in 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:
getLayoutAlignmentX
in interfaceLayoutManager2
- Parameters:
target
-- Returns:
- the X layout alignement
-
getLayoutAlignmentY
public float getLayoutAlignmentY(Container target)
Method getLayoutAlignmentY- Specified by:
getLayoutAlignmentY
in interfaceLayoutManager2
- Parameters:
target
-- Returns:
- the Y layout alignement
-
invalidateLayout
public void invalidateLayout(Container target)
Method invalidateLayout- Specified by:
invalidateLayout
in interfaceLayoutManager2
- Parameters:
target
-
-
addLayoutComponent
public void addLayoutComponent(String name, Component comp)
Method addLayoutComponent- Specified by:
addLayoutComponent
in interfaceLayoutManager
- Parameters:
name
-comp
-
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
Method minimumLayoutSize- Specified by:
minimumLayoutSize
in interfaceLayoutManager
- Parameters:
parent
-- Returns:
- the minimum dimension of the layout
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
Method preferredLayoutSize- Specified by:
preferredLayoutSize
in interfaceLayoutManager
- Parameters:
parent
-- Returns:
- the preferred dimension of the layout
-
maximumLayoutSize
public Dimension maximumLayoutSize(Container target)
Method maximumLayoutSize- Specified by:
maximumLayoutSize
in interfaceLayoutManager2
- Parameters:
target
-- Returns:
- the max dimension of the layout
-
removeLayoutComponent
public void removeLayoutComponent(Component comp)
Method removeLayoutComponent- Specified by:
removeLayoutComponent
in interfaceLayoutManager
- Parameters:
comp
-
-
layoutContainer
public void layoutContainer(Container parent)
Method layoutContainer- Specified by:
layoutContainer
in 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)
-
-