charva.awt
public abstract class Component extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected float |
_alignmentX
the X-alignment of this component
|
protected float |
_alignmentY
the Y-alignment of this component
|
protected Color |
_background
If the background color is null, this component inherits the
background color of its parent Container.
|
protected int |
_cursesColor
The number of this component's color-pair, as computed by the
ncurses COLOR_PAIR macro.
|
protected boolean |
_enabled
This flag is true if this component can react to user input.
|
protected java.util.Vector |
_focusListeners
A list of FocusListeners registered for this component.
|
protected Color |
_foreground
If the foreground color is null, this component inherits the
foreground color of its parent Container.
|
protected java.util.Vector |
_keyListeners
A list of KeyListeners registered for this component.
|
protected Point |
_origin
The coordinates of the top-left corner of the component, relative to
its parent container.
|
protected java.lang.ref.WeakReference |
_parent
A WeakReference to the Container (e.g Window, Panel or Dialog)
that contains us.
|
protected boolean |
_visible
A flag that determines whether this component should be displayed
(if its parent is displayed).
|
static float |
BOTTOM_ALIGNMENT |
static float |
CENTER_ALIGNMENT |
static float |
LEFT_ALIGNMENT |
static float |
RIGHT_ALIGNMENT |
static float |
TOP_ALIGNMENT |
Constructor and Description |
---|
Component()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addFocusListener(FocusListener fl_)
Register a FocusListener object for this component.
|
void |
addKeyListener(KeyListener kl_)
Register a KeyListener object for this component.
|
boolean |
contains(int x,
int y) |
boolean |
contains(Point p)
Checks whether this component "contains" the specified point,
where the point's x and y coordinates are defined to be relative
to the top left corner of the parent Container.
|
abstract void |
debug(int level_) |
abstract void |
draw()
To be implemented by concrete subclasses.
|
float |
getAlignmentX()
Returns the alignment along the X axis.
|
float |
getAlignmentY()
Returns the alignment along the Y axis.
|
Window |
getAncestorWindow()
Get the Window that contains this component.
|
Color |
getBackground()
Get the background color of this component.
|
Rectangle |
getBounds()
Get the bounding rectangle of this component, relative to
the origin of its parent Container.
|
int |
getCursesColor() |
Color |
getForeground()
Get the foreground color of this component.
|
abstract int |
getHeight() |
Point |
getLocation() |
Point |
getLocationOnScreen()
Return the absolute coordinates of this component's origin.
|
java.lang.String |
getName()
Returns the name of the component.
|
Container |
getParent()
Get the parent container of this component.
|
abstract Dimension |
getSize() |
abstract int |
getWidth() |
boolean |
hasFocus()
Returns true if this Component has the keyboard input focus.
|
void |
hide()
Deprecated.
This method has been replaced by
setVisible(boolean) . |
void |
invalidate()
Marks the component and all parents above it as needing to be laid out
again.
|
boolean |
isDisplayed()
A component is "displayed" if it is contained within a displayed Window.
|
boolean |
isEnabled()
Determine whether this component can react to user input.
|
boolean |
isFocusTraversable()
Indicates whether this component can be traversed using Tab or
Shift-Tab keyboard focus traversal.
|
boolean |
isRecursivelyVisible()
Determines whether this component will be displayed on the screen
if it's displayable.
|
boolean |
isTotallyObscured()
Return true if this component is totally obscured by one or more
windows that are stacked above it.
|
boolean |
isValid()
Determines whether this component has a valid layout.
|
boolean |
isVisible()
Returns true if this component is displayed when its parent
container is displayed.
|
abstract Dimension |
minimumSize() |
protected void |
processEvent(AWTEvent evt_)
Process events that are implemented by all components.
|
void |
processFocusEvent(FocusEvent fe_)
Invoke all the FocusListener callbacks that may have been registered
for this component.
|
void |
processKeyEvent(KeyEvent ke_)
Invoke all the KeyListener callbacks that may have been registered
for this component.
|
void |
processMouseEvent(MouseEvent e)
Process a MouseEvent that was generated by clicking the mouse
somewhere inside this component.
|
void |
repaint()
Causes this component to be repainted as soon as possible
(this is done by posting a RepaintEvent onto the system queue).
|
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 |
requestSync()
Causes a SyncEvent to be posted onto the AWT queue, thus requesting
a refresh of the physical screen.
|
void |
setBackground(Color color_)
Set the background color of this component.
|
void |
setBounds(int top_,
int left_,
int bottom_,
int right_) |
void |
setBounds(Point topleft_,
Dimension size_) |
void |
setBounds(Rectangle bounds) |
void |
setEnabled(boolean flag_)
Enable this component to react to user input.
|
void |
setForeground(Color color_)
Set the foreground color of this component.
|
void |
setLocation(int x_,
int y_) |
void |
setLocation(Point origin_) |
void |
setName(java.lang.String name_)
Sets the name of the component.
|
void |
setParent(Container container_)
Set the parent container of this component.
|
void |
setVisible(boolean visible_)
Shows or hides this component depending on the value of the
parameter
visible_ |
void |
show()
Deprecated.
This method has been replaced by
setVisible(boolean) . |
void |
validate()
Ensures that this component is laid out correctly.
|
void |
validateCursesColor()
Compute the component's ncurses color-pair from its foreground
and background colors.
|
protected Point _origin
protected java.lang.ref.WeakReference _parent
protected boolean _enabled
protected boolean _visible
setVisible(boolean)
,
isVisible()
protected java.util.Vector _keyListeners
protected java.util.Vector _focusListeners
protected float _alignmentX
protected float _alignmentY
protected Color _foreground
protected Color _background
protected int _cursesColor
A value of -1 indicates that the color-pair number needs to be recomputed.
public static final float TOP_ALIGNMENT
public static final float CENTER_ALIGNMENT
public static final float BOTTOM_ALIGNMENT
public static final float LEFT_ALIGNMENT
public static final float RIGHT_ALIGNMENT
public void setVisible(boolean visible_)
visible_
public void show()
setVisible(boolean)
.public void hide()
setVisible(boolean)
.public boolean isVisible()
public boolean isRecursivelyVisible()
true
if the component and all of its ancestors
are visible, false
otherwisepublic abstract void draw()
public boolean isDisplayed()
_visible
flag may be false.public Point getLocation()
public void setLocation(Point origin_)
public void setLocation(int x_, int y_)
public Point getLocationOnScreen()
public abstract Dimension getSize()
public abstract int getWidth()
public abstract int getHeight()
public Rectangle getBounds()
public void setBounds(Rectangle bounds)
public void setBounds(int top_, int left_, int bottom_, int right_)
public boolean contains(Point p)
public boolean contains(int x, int y)
public abstract Dimension minimumSize()
public void setParent(Container container_)
public Container getParent()
public void addKeyListener(KeyListener kl_)
public void addFocusListener(FocusListener fl_)
protected void processEvent(AWTEvent evt_)
public void processKeyEvent(KeyEvent ke_)
public void processMouseEvent(MouseEvent e)
public void processFocusEvent(FocusEvent fe_)
public Window getAncestorWindow()
public void requestFocus()
public boolean hasFocus()
public boolean isFocusTraversable()
public boolean isTotallyObscured()
public float getAlignmentX()
public float getAlignmentY()
public Color getForeground()
public Color getBackground()
public void setForeground(Color color_)
public void setBackground(Color color_)
public void setEnabled(boolean flag_)
public boolean isEnabled()
public void invalidate()
public void validate()
public void repaint()
public void requestSync()
public boolean isValid()
public abstract void debug(int level_)
public void setName(java.lang.String name_)
public java.lang.String getName()
public void validateCursesColor()
public int getCursesColor()