Package ej.widget.container
Class Canvas
- java.lang.Object
-
- ej.mwt.Widget
-
- ej.mwt.Container
-
- ej.widget.container.Canvas
-
public class Canvas extends ej.mwt.Container
Lays out any number of children freely.Each child is laid out at the position it has been given.
In a canvas, each child will have the size it has been given, or if desired, its optimal size.
-
-
Constructor Summary
Constructors Constructor Description Canvas()
Creates a canvas.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(ej.mwt.Widget child, int x, int y, int width, int height)
Adds the specified widget to this canvas.void
changeChildIndex(ej.mwt.Widget child, int index)
protected void
computeContentOptimalSize(ej.mwt.util.Size size)
protected void
layOutChildren(int contentWidth, int contentHeight)
void
removeAllChildren()
void
removeChild(ej.mwt.Widget child)
-
Methods inherited from class ej.mwt.Container
addChild, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, insertChild, layOutAlignedChild, layOutChild, renderChild, renderContent, replaceChild, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyle
-
Methods inherited from class ej.mwt.Widget
addClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getDesktop, getHeight, getParent, getStyle, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onAttached, onDetached, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle
-
-
-
-
Method Detail
-
addChild
public void addChild(ej.mwt.Widget child, int x, int y, int width, int height)
Adds the specified widget to this canvas. The widget is laid out with the given bounds.If the given width or height is
Widget.NO_CONSTRAINT
, the widget is fitted to its optimal width/height.- Parameters:
child
- the widget to add.x
- the x coordinate of the widget.y
- the y coordinate of the widget.width
- the width of the widget, orWidget.NO_CONSTRAINT
to use the widget optimal width.height
- the height of the widget, orWidget.NO_CONSTRAINT
to use the widget optimal height.- Throws:
java.lang.NullPointerException
- if the specified widget isnull
.java.lang.IllegalArgumentException
- if the specified widget is already in a hierarchy (already contained in a container or desktop).- See Also:
Container.addChild(Widget)
-
removeChild
public void removeChild(ej.mwt.Widget child)
- Overrides:
removeChild
in classej.mwt.Container
-
removeAllChildren
public void removeAllChildren()
- Overrides:
removeAllChildren
in classej.mwt.Container
-
changeChildIndex
public void changeChildIndex(ej.mwt.Widget child, int index)
- Overrides:
changeChildIndex
in classej.mwt.Container
-
computeContentOptimalSize
protected void computeContentOptimalSize(ej.mwt.util.Size size)
- Specified by:
computeContentOptimalSize
in classej.mwt.Widget
-
layOutChildren
protected void layOutChildren(int contentWidth, int contentHeight)
- Specified by:
layOutChildren
in classej.mwt.Container
-
-