public class CardLayout2 extends CardLayout
CardLayout.
Because in the original layout is not overridable : everything is package level accessible.
This new class offers to test if a constrains (as a Serializable) is actually dealed by the layout,
via the method contains(Serializable).
We had also another method to obtain the current visible component in a container layouted by the class,
via the method getVisibleComponent(Container).| Modifier and Type | Field and Description |
|---|---|
protected List<Serializable> |
contexts
list of already loaded context (since the
CardLayout.vector attribute is package visible... |
protected boolean |
useOnlyVisibleComponentDimension
A flag to compute dimension only on visible component.
|
| Constructor and Description |
|---|
CardLayout2() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(Component comp,
Object constraints) |
protected void |
checkConstraints(String constraints) |
protected void |
checkContainer(Container container) |
boolean |
contains(Serializable constraints)
Test if a constrains is contained in the layout.
|
Component |
getComponent(Container container,
String constraints) |
Serializable[] |
getContexts() |
Component |
getVisibleComponent(Container container)
Obtain the visible component in the container.
|
boolean |
isUseOnlyVisibleComponentDimension() |
void |
layoutContainer(Container parent)
Lays out the specified container using this card layout.
|
Dimension |
maximumLayoutSize(Container target)
Returns the maximum dimensions for this layout given the components
in the specified target container.
|
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size for the specified panel.
|
Dimension |
preferredLayoutSize(Container parent)
Determines the preferred size of the container argument using
this card layout.
|
void |
removeLayoutComponent(Component comp,
Serializable constraints) |
void |
reset(Container parent)
remove from cardlayout and linked container all his components.
|
void |
setUseOnlyVisibleComponentDimension(boolean useOnlyVisibleComponentDimension) |
addLayoutComponent, first, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getVgap, invalidateLayout, last, next, previous, removeLayoutComponent, setHgap, setVgap, show, toStringprotected final List<Serializable> contexts
CardLayout.vector attribute is package visible...protected boolean useOnlyVisibleComponentDimension
public void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent in interface LayoutManager2addLayoutComponent in class CardLayoutpublic void removeLayoutComponent(Component comp, Serializable constraints)
public boolean contains(Serializable constraints)
constraints - l'identifiant a testertrue si l'identifiant est deja present dans le
layout, false otherwise.public Component getVisibleComponent(Container container)
container - the container using this layoutpublic Dimension preferredLayoutSize(Container parent)
preferredLayoutSize in interface LayoutManagerpreferredLayoutSize in class CardLayoutparent - the parent container in which to do the layoutContainer.getPreferredSize(),
CardLayout.minimumLayoutSize(java.awt.Container)public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize in interface LayoutManagerminimumLayoutSize in class CardLayoutparent - the parent container in which to do the layoutContainer.doLayout(),
CardLayout.preferredLayoutSize(java.awt.Container)public Dimension maximumLayoutSize(Container target)
maximumLayoutSize in interface LayoutManager2maximumLayoutSize in class CardLayouttarget - the component which needs to be laid outContainer,
minimumLayoutSize(java.awt.Container),
preferredLayoutSize(java.awt.Container)public void layoutContainer(Container parent)
parent container is reshaped
to be the size of the container, minus space for surrounding
insets, horizontal gaps, and vertical gaps.layoutContainer in interface LayoutManagerlayoutContainer in class CardLayoutparent - the parent container in which to do the layoutContainer.doLayout()public boolean isUseOnlyVisibleComponentDimension()
public void setUseOnlyVisibleComponentDimension(boolean useOnlyVisibleComponentDimension)
public void reset(Container parent)
parent - the parent container linked with the layoutprotected void checkContainer(Container container)
protected void checkConstraints(String constraints)
public Serializable[] getContexts()
Copyright © 2008–2019 Ultreia.io. All rights reserved.