| java.lang.Object java.awt.Component java.awt.Container
All known Subclasses: java.awt.Panel, basis.demos.Demo, basis.Builder, java.awt.ScrollPane, java.awt.Window,
Container | public class Container extends Component (Code) | | A generic Abstract Window Toolkit(AWT) container object is a component
that can contain other AWT components.
Components added to a container are tracked in a list. The order
of the list will define the components' front-to-back stacking order
within the container. If no index is specified when adding a
component to a container, it will be added to the end of the list
(and hence to the bottom of the stacking order).
version: 1.9, 08/19/02 author: Nicholas Allen See Also: java.awt.Container.add(java.awt.Componentint) See Also: java.awt.Container.getComponent(int) See Also: java.awt.LayoutManager since: JDK1.0 |
Constructor Summary | |
public | Container() Constructs a new Container. |
Method Summary | |
public Component | add(Component comp) Adds the specified component to the end of this container.
Parameters: comp - the component to be added. | public Component | add(String name, Component comp) Adds the specified component to this container. | public Component | add(Component comp, int index) Adds the specified component to this container at the given
position.
Parameters: comp - the component to be added. Parameters: index - the position at which to insert the component,or -1 to insert the component at the end. | public void | add(Component comp, Object constraints) Adds the specified component to the end of this container. | public void | add(Component comp, Object constraints, int index) Adds the specified component to this container with the specified
constraints at the specified index. | public synchronized void | addContainerListener(ContainerListener l) Adds the specified container listener to receive container events
from this container. | protected void | addImpl(Component comp, Object constraints, int index) Adds the specified component to this container at the specified
index. | public void | addNotify() Notifies the container to create a peer. | public int | countComponents() | public void | deliverEvent(Event e) | public void | doLayout() Causes this container to lay out its components. | boolean | eventEnabled(AWTEvent e) | public float | getAlignmentX() Returns the alignment along the x axis. | public float | getAlignmentY() Returns the alignment along the y axis. | public Component | getComponent(int n) Gets the nth component in this container.
Parameters: n - the index of the component to get. | public Component | getComponentAt(int x, int y) Locates the component that contains the x,y position. | public Component | getComponentAt(Point p) Gets the component that contains the specified point.
Parameters: p - the point. | public int | getComponentCount() Gets the number of components in this panel. | public Component[] | getComponents() Gets all the components in this container. | public Insets | getInsets() Determines the insets of this container, which indicate the size
of the container's border. | public LayoutManager | getLayout() Gets the layout manager for this container. | public Dimension | getMaximumSize() Returns the maximum size of this container. | public Dimension | getMinimumSize() Returns the minimum size of this container. | public Dimension | getPreferredSize() Returns the preferred size of this container. | Window | getWindow() | public Insets | insets() | public void | invalidate() Invalidates the container. | public boolean | isAncestorOf(Component c) Checks if the component is contained in the component hierarchy of
this container. | public void | layout() | void | lightweightPrint(Graphics g) Simulates the peer callbacks into java.awt for printing of
lightweight Containers. | public void | list(PrintStream out, int indent) Prints a listing of this container to the specified output
stream. | public void | list(PrintWriter out, int indent) Prints out a list, starting at the specified indention, to the specified
print writer. | public Component | locate(int x, int y) | public Dimension | minimumSize() | void | nextFocus(Component base) | public void | paint(Graphics g) Paints the container. | public void | paintComponents(Graphics g) Paints each of the components in this container. | protected String | paramString() Returns the parameter string representing the state of this
container. | public Dimension | preferredSize() | public void | print(Graphics g) Prints the container. | public void | printComponents(Graphics g) Prints each of the components in this container. | protected void | processContainerEvent(ContainerEvent e) Processes container events occurring on this container by
dispatching them to any registered ContainerListener objects. | protected void | processEvent(AWTEvent e) Processes events on this container. | public void | remove(int index) Removes the component, specified by index ,
from this container. | public void | remove(Component comp) Removes the specified component from this container. | public void | removeAll() Removes all the components from this container. | public synchronized void | removeContainerListener(ContainerListener l) Removes the specified container listener so it no longer receives
container events from this container. | public void | removeNotify() Notifies this container and all of its subcomponents to remove
their peers. | public void | setLayout(LayoutManager mgr) Sets the layout manager for this container. | void | transferFocus(Component base) | public void | update(Graphics g) Updates the container. | public void | validate() Validates this container and all of its subcomponents. | protected void | validateTree() Recursively descends the container tree and recomputes the
layout for any subtrees marked as needing it (those marked as
invalid). |
ncomponents | int ncomponents(Code) | | The number of components in this container.
|
Container | public Container()(Code) | | Constructs a new Container. Containers can be extended directly,
but are lightweight in this case and must be contained by a parent
somewhere higher up in the component tree that is native.
(such as Frame for example).
|
add | public Component add(Component comp)(Code) | | Adds the specified component to the end of this container.
Parameters: comp - the component to be added. the component argument. since: JDK1.0 |
add | public Component add(String name, Component comp)(Code) | | Adds the specified component to this container.
It is strongly advised to use the 1.1 method, add(Component, Object),
in place of this method.
|
add | public Component add(Component comp, int index)(Code) | | Adds the specified component to this container at the given
position.
Parameters: comp - the component to be added. Parameters: index - the position at which to insert the component,or -1 to insert the component at the end. the component comp See Also: Container.remove since: JDK1.0 |
add | public void add(Component comp, Object constraints)(Code) | | Adds the specified component to the end of this container.
Also notifies the layout manager to add the component to
this container's layout using the specified constraints object.
Parameters: comp - the component to be added Parameters: constraints - an object expressinglayout contraints for this component See Also: java.awt.LayoutManager since: JDK1.1 |
add | public void add(Component comp, Object constraints, int index)(Code) | | Adds the specified component to this container with the specified
constraints at the specified index. Also notifies the layout
manager to add the component to the this container's layout using
the specified constraints object.
Parameters: comp - the component to be added Parameters: constraints - an object expressing layout contraints for this Parameters: index - the position in the container's list at which to insertthe component. -1 means insert at the end.component See Also: Container.remove See Also: LayoutManager |
addContainerListener | public synchronized void addContainerListener(ContainerListener l)(Code) | | Adds the specified container listener to receive container events
from this container.
Parameters: l - the container listener |
addImpl | protected void addImpl(Component comp, Object constraints, int index)(Code) | | Adds the specified component to this container at the specified
index. This method also notifies the layout manager to add
the component to this container's layout using the specified
constraints object.
This is the method to override if a program needs to track
every add request to a container. An overriding method should
usually include a call to the superclass's version of the method:
super.addImpl(comp, constraints, index)
Parameters: comp - the component to be added. Parameters: constraints - an object expressing layout contraintsfor this component. Parameters: index - the position in the container's list at which toinsert the component, where -1 means insert at the end. See Also: java.awt.Container.add(java.awt.Component) See Also: java.awt.Container.add(java.awt.Componentint) See Also: java.awt.Container.add(java.awt.Componentjava.lang.Object) See Also: java.awt.LayoutManager since: JDK1.1 |
addNotify | public void addNotify()(Code) | | Notifies the container to create a peer. It will also
notify the components contained in this container.
This method should be called by Container.add ,
and not by user code directly.
See Also: Container.removeNotify since: JDK1.0 |
countComponents | public int countComponents()(Code) | | |
getAlignmentX | public float getAlignmentX()(Code) | | Returns the alignment along the x axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getAlignmentY | public float getAlignmentY()(Code) | | Returns the alignment along the y axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getComponent | public Component getComponent(int n)(Code) | | Gets the nth component in this container.
Parameters: n - the index of the component to get. the nth component in this container. exception: ArrayIndexOutOfBoundsException - if the nth value does not exist. since: JDK1.0 |
getComponentAt | public Component getComponentAt(int x, int y)(Code) | | Locates the component that contains the x,y position. The
top-most child component is returned in the case where there
is overlap in the components. This is determined by finding
the component closest to the index 0 that claims to contain
the given point via Component.contains().
Parameters: x - the x coordinate Parameters: y - the y coordinate null if the component does not contain the position.If there is no child component at the requested point and thepoint is within the bounds of the container the container itselfis returned; otherwise the top-most child is returned. See Also: Component.contains since: JDK1.1 |
getComponentAt | public Component getComponentAt(Point p)(Code) | | Gets the component that contains the specified point.
Parameters: p - the point. returns the component that contains the point,or null if the component doesnot contain the point. See Also: java.awt.Component.contains since: JDK1.1 |
getComponentCount | public int getComponentCount()(Code) | | Gets the number of components in this panel.
the number of components in this panel. See Also: java.awt.Container.getComponent since: JDK1.1 |
getComponents | public Component[] getComponents()(Code) | | Gets all the components in this container.
an array of all the components in this container. since: JDK1.0 |
getInsets | public Insets getInsets()(Code) | | Determines the insets of this container, which indicate the size
of the container's border.
A Frame object, for example, has a top inset that
corresponds to the height of the frame's title bar.
the insets of this container. See Also: java.awt.Insets See Also: java.awt.LayoutManager since: JDK1.1 |
invalidate | public void invalidate()(Code) | | Invalidates the container. The container and all parents
above it are marked as needing to be laid out. This method can
be called often, so it needs to execute quickly.
See Also: Container.validate See Also: Container.layout See Also: LayoutManager |
isAncestorOf | public boolean isAncestorOf(Component c)(Code) | | Checks if the component is contained in the component hierarchy of
this container.
Parameters: c - the component true if it is an ancestor;true otherwise. since: JDK1.1 |
layout | public void layout()(Code) | | |
list | public void list(PrintStream out, int indent)(Code) | | Prints a listing of this container to the specified output
stream. The listing starts at the specified indentation.
Parameters: out - a print stream. Parameters: indent - the number of spaces to indent. See Also: java.awt.Component.list(java.io.PrintStreamint) since: JDK |
list | public void list(PrintWriter out, int indent)(Code) | | Prints out a list, starting at the specified indention, to the specified
print writer.
|
paint | public void paint(Graphics g)(Code) | | Paints the container. This forwards the paint to any lightweight components
that are children of this container. If this method is reimplemented,
super.paint(g) should be called so that lightweight components are properly
rendered. If a child component is entirely clipped by the current clipping
setting in g, paint() will not be forwarded to that child.
Parameters: g - the specified Graphics window See Also: java.awt.Component.update(java.awt.Graphics) |
paramString | protected String paramString()(Code) | | Returns the parameter string representing the state of this
container. This string is useful for debugging.
the parameter string of this container. since: JDK1.0 |
print | public void print(Graphics g)(Code) | | Prints the container. This forwards the print to any lightweight components
that are children of this container. If this method is reimplemented,
super.print(g) should be called so that lightweight components are properly
rendered. If a child component is entirely clipped by the current clipping
setting in g, print() will not be forwarded to that child.
Parameters: g - the specified Graphics window See Also: java.awt.Component.update(java.awt.Graphics) |
processContainerEvent | protected void processContainerEvent(ContainerEvent e)(Code) | | Processes container events occurring on this container by
dispatching them to any registered ContainerListener objects.
NOTE: This method will not be called unless container events
are enabled for this component; this happens when one of the
following occurs:
a) A ContainerListener object is registered via addContainerListener()
b) Container events are enabled via enableEvents()
See Also: Component.enableEvents Parameters: e - the container event |
processEvent | protected void processEvent(AWTEvent e)(Code) | | Processes events on this container. If the event is a ContainerEvent,
it invokes the processContainerEvent method, else it invokes its
superclass's processEvent.
Parameters: e - the event |
remove | public void remove(int index)(Code) | | Removes the component, specified by index ,
from this container.
Parameters: index - the index of the component to be removed. See Also: Container.add since: JDK1.1 |
remove | public void remove(Component comp)(Code) | | Removes the specified component from this container.
Parameters: comp - the component to be removed See Also: Container.add since: JDK1.0 |
removeContainerListener | public synchronized void removeContainerListener(ContainerListener l)(Code) | | Removes the specified container listener so it no longer receives
container events from this container.
Parameters: l - the container listener |
update | public void update(Graphics g)(Code) | | Updates the container. This forwards the update to any lightweight components
that are children of this container. If this method is reimplemented,
super.update(g) should be called so that lightweight components are properly
rendered. If a child component is entirely clipped by the current clipping
setting in g, update() will not be forwarded to that child.
Parameters: g - the specified Graphics window See Also: java.awt.Component.update(java.awt.Graphics) |
validate | public void validate()(Code) | | Validates this container and all of its subcomponents.
AWT uses validate to cause a container to lay out
its subcomponents again after the components it contains
have been added to or modified.
See Also: Container.validate See Also: Component.invalidate since: JDK1.0 |
validateTree | protected void validateTree()(Code) | | Recursively descends the container tree and recomputes the
layout for any subtrees marked as needing it (those marked as
invalid). Synchronization should be provided by the method
that calls this one: validate .
|
Methods inherited from java.awt.Component | public boolean action(Event evt, Object what)(Code)(Java Doc) public synchronized void add(PopupMenu popup)(Code)(Java Doc) public synchronized void addComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void addFocusListener(FocusListener l)(Code)(Java Doc) public synchronized void addKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void addMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void addMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) boolean areInputMethodsEnabled()(Code)(Java Doc) public Rectangle bounds()(Code)(Java Doc) final void checkEnableNewEventsOnly(Object listener)(Code)(Java Doc) public int checkImage(Image image, ImageObserver observer)(Code)(Java Doc) public int checkImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)(Code)(Java Doc) String constructComponentName()(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public boolean contains(Point p)(Code)(Java Doc) public Image createImage(ImageProducer producer)(Code)(Java Doc) public Image createImage(int width, int height)(Code)(Java Doc) ComponentXWindow createXWindow()(Code)(Java Doc) public void deliverEvent(Event e)(Code)(Java Doc) public void disable()(Code)(Java Doc) final protected void disableEvents(long eventsToDisable)(Code)(Java Doc) final public void dispatchEvent(AWTEvent e)(Code)(Java Doc) void dispatchEventImpl(AWTEvent e)(Code)(Java Doc) public void doLayout()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void enable(boolean b)(Code)(Java Doc) final protected synchronized void enableEvents(long eventsToEnable)(Code)(Java Doc) boolean eventEnabled(AWTEvent e)(Code)(Java Doc) Component findFocusDelegate(Container container)(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public Color getBackground()(Code)(Java Doc) public Rectangle getBounds()(Code)(Java Doc) public ColorModel getColorModel()(Code)(Java Doc) public Component getComponentAt(int x, int y)(Code)(Java Doc) public Component getComponentAt(Point p)(Code)(Java Doc) public Cursor getCursor()(Code)(Java Doc) Component getFocusDelegate()(Code)(Java Doc) public Font getFont()(Code)(Java Doc) Component getFontAndColorDelegate()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Color getForeground()(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) InputContext getInputContext()(Code)(Java Doc) public Locale getLocale()(Code)(Java Doc) public Point getLocation()(Code)(Java Doc) public Point getLocationOnScreen()(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public String getName()(Code)(Java Doc) Container getNativeContainer()(Code)(Java Doc) public Container getParent()(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public Dimension getSize()(Code)(Java Doc) public Toolkit getToolkit()(Code)(Java Doc) final public Object getTreeLock()(Code)(Java Doc) public boolean gotFocus(Event evt, Object what)(Code)(Java Doc) public boolean handleEvent(Event evt)(Code)(Java Doc) public void hide()(Code)(Java Doc) public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)(Code)(Java Doc) public boolean inside(int x, int y)(Code)(Java Doc) public void invalidate()(Code)(Java Doc) static void invokeAndWait(Runnable runnable)(Code)(Java Doc) public boolean isDisplayable()(Code)(Java Doc) public boolean isEnabled()(Code)(Java Doc) public boolean isFocusTraversable()(Code)(Java Doc) public boolean isLightweight()(Code)(Java Doc) boolean isLightweightWhenDisplayable()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isShowing()(Code)(Java Doc) public boolean isValid()(Code)(Java Doc) public boolean isVisible()(Code)(Java Doc) public boolean keyDown(Event evt, int key)(Code)(Java Doc) public boolean keyUp(Event evt, int key)(Code)(Java Doc) public void layout()(Code)(Java Doc) void lightweightPrint(Graphics g)(Code)(Java Doc) public void list()(Code)(Java Doc) public void list(PrintStream out)(Code)(Java Doc) public void list(PrintStream out, int indent)(Code)(Java Doc) public void list(PrintWriter out)(Code)(Java Doc) public void list(PrintWriter out, int indent)(Code)(Java Doc) public Component locate(int x, int y)(Code)(Java Doc) public Point location()(Code)(Java Doc) public boolean lostFocus(Event evt, Object what)(Code)(Java Doc) public Dimension minimumSize()(Code)(Java Doc) public boolean mouseDown(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseDrag(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseEnter(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseExit(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseMove(Event evt, int x, int y)(Code)(Java Doc) public boolean mouseUp(Event evt, int x, int y)(Code)(Java Doc) public void move(int x, int y)(Code)(Java Doc) public void nextFocus()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) public void paintAll(Graphics g)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public boolean postEvent(Event e)(Code)(Java Doc) public Dimension preferredSize()(Code)(Java Doc) public boolean prepareImage(Image image, ImageObserver observer)(Code)(Java Doc) public boolean prepareImage(Image image, int width, int height, ImageObserver observer)(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void processComponentEvent(ComponentEvent e)(Code)(Java Doc) protected void processEvent(AWTEvent e)(Code)(Java Doc) protected void processFocusEvent(FocusEvent e)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) public synchronized void remove(MenuComponent popup)(Code)(Java Doc) public synchronized void removeComponentListener(ComponentListener l)(Code)(Java Doc) public synchronized void removeFocusListener(FocusListener l)(Code)(Java Doc) public synchronized void removeKeyListener(KeyListener l)(Code)(Java Doc) public synchronized void removeMouseListener(MouseListener l)(Code)(Java Doc) public synchronized void removeMouseMotionListener(MouseMotionListener l)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public void repaint()(Code)(Java Doc) public void repaint(long tm)(Code)(Java Doc) public void repaint(int x, int y, int width, int height)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public void reshape(int x, int y, int width, int height)(Code)(Java Doc) public void resize(int width, int height)(Code)(Java Doc) public void resize(Dimension d)(Code)(Java Doc) public void setBackground(Color c)(Code)(Java Doc) public void setBounds(int x, int y, int width, int height)(Code)(Java Doc) public void setBounds(Rectangle r)(Code)(Java Doc) public synchronized void setCursor(Cursor cursor)(Code)(Java Doc) public void setEnabled(boolean b)(Code)(Java Doc) public void setFont(Font f)(Code)(Java Doc) public void setForeground(Color c)(Code)(Java Doc) public void setLocale(Locale l)(Code)(Java Doc) public void setLocation(int x, int y)(Code)(Java Doc) public void setLocation(Point p)(Code)(Java Doc) public void setName(String name)(Code)(Java Doc) public void setSize(int width, int height)(Code)(Java Doc) public void setSize(Dimension d)(Code)(Java Doc) public void setVisible(boolean b)(Code)(Java Doc) public void show()(Code)(Java Doc) public void show(boolean b)(Code)(Java Doc) public Dimension size()(Code)(Java Doc) public String toString()(Code)(Java Doc) public void transferFocus()(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void validate()(Code)(Java Doc)
|
|
|