|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.Component
com.sun.dtv.lwuit.Container
public class Container
A composite pattern with Component
, allows nesting and arranging multiple
components using a pluggable layout manager architecture. Containers can be nested
one within the other to form elaborate UI's.
Layout
,
Component
Field Summary |
---|
Fields inherited from class com.sun.dtv.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Fields inherited from interface com.sun.dtv.ui.Animated |
---|
ALTERNATING, LOOP, REPEATING |
Constructor Summary | |
---|---|
Container()
Constructs a new Container, with a FlowLayout . |
|
Container(Layout layout)
Constructs a new Container with a new layout manager. |
Method Summary | |
---|---|
void |
addComponent(Component cmp)
Adds a Component to the Container. |
void |
addComponent(int index,
Component cmp)
This method adds the Component at a specific index location in the Container Components array. |
void |
addComponent(Object constraints,
Component cmp)
Adds a Component to the Container. |
boolean |
contains(Component cmp)
Returns true if the given component is within the hierarchy of this container. |
void |
doLayout()
Lays out the container. |
Component |
getComponentAt(int index)
Returns the Component at a given index. |
Component |
getComponentAt(int x,
int y)
Returns a Component that exists in the given x, y coordinates by traversing component objects and invoking contains. |
int |
getComponentCount()
Returns the number of components. |
int |
getComponentIndex(Component cmp)
Returns the Component index in the Container. |
Layout |
getLayout()
Returns the layout manager responsible for arranging this container. |
int |
getLayoutHeight()
Returns the height for layout manager purposes, this takes scrolling into consideration unlike the getWidth method. |
int |
getLayoutWidth()
Returns the width for layout manager purposes, this takes scrolling into consideration unlike the getWidth method. |
Matte |
getMatte()
Return the Matte currently associated with the
component implementing this interface. |
void |
invalidate()
Same as setShouldCalcPreferredSize(true) but made accessible for layout managers. |
boolean |
isScrollableX()
Indicates whether the component should/could scroll on the X axis. |
boolean |
isScrollableY()
Indicates whether the component should/could scroll on the Y axis. |
void |
layoutContainer()
Performs the layout of the container if a layout is necessary. |
void |
paint(Graphics g)
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering. |
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event will call this method. |
void |
refreshTheme()
Makes sure the component is up to date with the current style object. |
void |
removeAll()
remove all Components from container. |
void |
removeComponent(Component cmp)
removes a Component from the Container. |
void |
replace(Component current,
Component next,
Transition t)
This method replaces the current Component with the next Component. |
void |
revalidate()
Re-layout the container, this is useful when we modify the container hierarchy and need to redo the layout. |
protected void |
scrollComponentToVisible(Component c)
Makes sure the component is visible in the scroll if this container is scrollable |
void |
setCellRenderer(boolean cellRenderer)
Used as an optimization to mark that this component is currently being used as a cell renderer. |
void |
setLayout(Layout layout)
Sets the layout manager responsible for arranging this container. |
void |
setMatte(Matte matte)
Adds an Matte to the component implementing this
interface in order to enable matte compositing. |
void |
setScrollable(boolean scrollable)
The equivalent of calling both setScrollableY and setScrollableX. |
void |
setScrollableX(boolean scrollableX)
Sets whether the component should/could scroll on the X axis. |
void |
setScrollableY(boolean scrollableY)
Sets whether the component should/could scroll on the Y axis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Container(Layout layout)
layout
- the specified layout managerpublic Container()
FlowLayout
.
Method Detail |
---|
public Layout getLayout()
setLayout(com.sun.dtv.lwuit.layouts.Layout)
public void setLayout(Layout layout)
layout
- the specified layout managergetLayout()
public void invalidate()
public int getLayoutWidth()
public int getLayoutHeight()
public void addComponent(Component cmp)
cmp
- the component to be addedpublic void addComponent(Object constraints, Component cmp)
constraints
- this method is useful when the Layout requires a constraint
such as the BorderLayout.
In this case you need to specify an additional data when you add a Component,
such as "CENTER", "NORTH"...cmp
- component to addpublic void addComponent(int index, Component cmp)
index
- location to insert the Componentcmp
- the Component to add
ArrayIndexOutOfBoundsException
- if index is out of bounds
IllegalArgumentException
- if Component is already contained or
the cmp is a Form Componentpublic void replace(Component current, Component next, Transition t)
current
- a Component to remove from the Containernext
- a Component that replaces the current Componentt
- a Transition between the add and removal of the Components
a Transition can be nullpublic void removeComponent(Component cmp)
cmp
- the removed componentpublic void removeAll()
public void revalidate()
public void paint(Graphics g)
Component
paint
in interface Animation
paint
in class Component
g
- the component graphicspublic void layoutContainer()
public void doLayout()
public int getComponentCount()
public Component getComponentAt(int index)
index
- of the Component you wish to get
ArrayIndexOutOfBoundsException
- if an invalid index was given.public int getComponentIndex(Component cmp)
cmp
- the component to search for
public boolean contains(Component cmp)
cmp
- a Component to check
public Component getComponentAt(int x, int y)
x
- absolute screen locationy
- absolute screen location
Component.contains(int, int)
public void pointerPressed(int x, int y)
Component
pointerPressed
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic void refreshTheme()
Component
refreshTheme
in class Component
public boolean isScrollableX()
Component
isScrollableX
in class Component
public boolean isScrollableY()
Component
isScrollableY
in class Component
public void setScrollableX(boolean scrollableX)
scrollableX
- whether the component should/could scroll on the X axispublic void setScrollableY(boolean scrollableY)
scrollableY
- whether the component should/could scroll on the Y axispublic void setScrollable(boolean scrollable)
scrollable
- whether the component should/could scroll on the
X and Y axispublic void setCellRenderer(boolean cellRenderer)
Component
setCellRenderer
in class Component
cellRenderer
- indicate whether this component is currently being
used as a cell rendererpublic void setMatte(Matte matte) throws MatteException
MatteEnabled
Matte
to the component implementing this
interface in order to enable matte compositing. If there is already a
Matte assigned to the component, and this Matte is animated, it has to be
stopped before any call to this method.
setMatte
in interface MatteEnabled
matte
- the Matte
to be assigned to the
component. At any point of time there can only be one matte associated to
the component, that's way any matte that has been associated before will
be overriden by a call to this method.
The Matte parameter can also be null, in this case there is no matte
associated with the component after the call, even if there had been one
before.
MatteException
- if the Matte
has an
unsupported type, the platform does not support mattes at all, or an
animated matte is associated with the component and is still runningMatteEnabled.getMatte()
public Matte getMatte()
MatteEnabled
Matte
currently associated with the
component implementing this interface.
getMatte
in interface MatteEnabled
Matte
currently associated with the
component or null if there is noneMatteEnabled.setMatte(com.sun.dtv.ui.Matte)
protected void scrollComponentToVisible(Component c)
c
- the component that will be scrolling for visibility
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |