public abstract class Container extends Component
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector |
_components
The list of components contained within this Container.
|
protected Component |
_currentFocus
The component (which may itself be a Container) inside this Container
that currently has the input focus (or, if the input focus is
currently outside this Container, the component to which focus will
return if and when this Container regains focus).
|
protected Insets |
_insets
The insets define how much padding to insert inside the Container,
to take into account the border frame (if any).
|
protected boolean |
_isValid
A flag that is set to true when the container is laid out, and set to
false when a component is added or removed from the container
(indicating that it needs to be laid out again).
|
protected LayoutManager |
_layoutMgr
The layout manager that will be used to lay out the components.
|
protected Dimension |
_minimumSize
Used for caching the minimum size of this container, so that we don't
have to keep recalculating it.
|
protected Dimension |
_size
The container's size
|
_alignmentX, _alignmentY, _background, _cursesColor, _enabled, _focusListeners, _foreground, _keyListeners, _origin, _parent, _visible, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
Container() |
Modifier and Type | Method and Description |
---|---|
Component |
add(Component component_)
The contained component will inherit the foreground and background
colors of the container if they have not been set yet.
|
void |
add(Component component_,
java.lang.Object constraint_)
Adds the specified component to the end of this container.
|
void |
debug(int level_) |
void |
doLayout()
doLayout is intended to be used by subclasses of Container, such
as Window, JPanel and JScrollPane.
|
void |
draw()
Draw all the components in this container.
|
Component |
findComponentAt(int x,
int y)
Returns the visible component that contains the specified point,
or null if no visible component contains the point.
|
Component |
findComponentAt(Point p)
Returns the visible component that contains the specified point,
or null if no visible component contains the point.
|
Component |
getComponent(int n)
Returns the component at the specified index.
|
Component |
getComponentAt(int x,
int y)
Returns the component that contains the specified point, or null
if no component contains the point.
|
protected Component |
getComponentAt(int x,
int y,
boolean checkVisibility) |
Component |
getComponentAt(Point p)
Returns the component that contains the specified point, or null
if no component contains the point.
|
int |
getComponentCount()
Returns the number of components in this Container.
|
Component[] |
getComponents()
Returns an array of all the components in this container.
|
Component |
getCurrentFocus()
Return a reference to the (non-container) component inside this
Container that has the keyboard input focus (or would have it,
if the focus was inside this container).
|
int |
getHeight() |
Insets |
getInsets() |
Dimension |
getSize() |
int |
getWidth() |
void |
invalidate()
Marks the container and all parents above it as needing to be laid out
again.
|
boolean |
isFocusTraversable()
Return true if any of the components within this Container
are focus-traversable (i.e. will accept keyboard input focus when
TAB or SHIFT-TAB is pressed).
|
boolean |
isValid()
Determines whether this component is valid.
|
Dimension |
minimumSize() |
void |
nextFocus()
Set the _currentFocus to refer to the next focus-traversable component
in the list of contained components, and put FocusEvents on the queue,
one for the component that is losing the focus and one for the component
gaining the focus.
|
void |
previousFocus()
Set the _currentFocus to refer to the previous focus-traversable
component in the list of contained components, and put FocusEvents on
the queue, one for the component that is losing the focus and one for
the component gaining the focus.
|
void |
processKeyEvent(KeyEvent ke_)
Invoke all the KeyListener callbacks that may have been registered
for this component.
|
void |
remove(Component component_)
Removes the specified component from this container.
|
void |
requestFocus()
This method should be invoked by all subclasses of Component
which override this method; because this method generates the
FOCUS_GAINED event when the component gains the keyboard focus.
|
void |
setBackground(Color color_)
Sets the background color of this container and all its
contained components that do not yet have their background
color set.
|
void |
setBounds(int top_,
int left_,
int bottom_,
int right_) |
void |
setBounds(Point topleft_,
Dimension size_) |
void |
setBounds(Rectangle bounds) |
void |
setFocus(Component focus_)
Set this container's current keyboard focus.
|
void |
setForeground(Color color_)
Sets the foreground color of this container and all its
contained components that do not yet have their foreground
color set.
|
void |
setHeight(int height_) |
void |
setLayout(LayoutManager mgr_) |
void |
setSize(Dimension size_) |
void |
setSize(int width_,
int height_) |
void |
setWidth(int width_) |
void |
validate()
Validates this container and all of its contained components.
|
addFocusListener, addKeyListener, contains, contains, getAlignmentX, getAlignmentY, getAncestorWindow, getBackground, getBounds, getCursesColor, getForeground, getLocation, getLocationOnScreen, getName, getParent, hasFocus, hide, isDisplayed, isEnabled, isRecursivelyVisible, isTotallyObscured, isVisible, processEvent, processFocusEvent, processMouseEvent, repaint, requestSync, setEnabled, setLocation, setLocation, setName, setParent, setVisible, show, validateCursesColor
protected java.util.Vector _components
protected Dimension _size
protected LayoutManager _layoutMgr
protected Component _currentFocus
protected Insets _insets
protected boolean _isValid
protected Dimension _minimumSize
public void doLayout()
public void setSize(Dimension size_)
public void setSize(int width_, int height_)
public void setHeight(int height_)
public void setWidth(int width_)
public void setBounds(int top_, int left_, int bottom_, int right_)
public Dimension minimumSize()
minimumSize
in class Component
public Component getComponent(int n)
protected Component getComponentAt(int x, int y, boolean checkVisibility)
public Component getComponentAt(Point p)
public Component getComponentAt(int x, int y)
public final Component findComponentAt(Point p)
public final Component findComponentAt(int x, int y)
public Component add(Component component_)
public void remove(Component component_)
public void add(Component component_, java.lang.Object constraint_)
public void setLayout(LayoutManager mgr_)
public Component[] getComponents()
public int getComponentCount()
public void draw()
public void setForeground(Color color_)
setForeground
in class Component
public void setBackground(Color color_)
setBackground
in class Component
public void processKeyEvent(KeyEvent ke_)
Component
processKeyEvent
in class Component
public void requestFocus()
Component
requestFocus
in class Component
public Component getCurrentFocus()
IllegalComponentStateException
- if there is no
focus-traversable component in this container.public void nextFocus()
public void previousFocus()
public void setFocus(Component focus_)
public boolean isFocusTraversable()
isFocusTraversable
in class Component
public Insets getInsets()
public void validate()
public boolean isValid()
public void invalidate()
invalidate
in class Component