protected abstract class MenuComponent.AccessibleAWTMenuComponent extends AccessibleContext implements Serializable, AccessibleComponent, AccessibleSelection
ACCESSIBLE_ACTION_PROPERTY, ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, ACCESSIBLE_CARET_PROPERTY, ACCESSIBLE_CHILD_PROPERTY, ACCESSIBLE_COMPONENT_BOUNDS_CHANGED, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_HYPERTEXT_OFFSET, ACCESSIBLE_INVALIDATE_CHILDREN, ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_TABLE_CAPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED, ACCESSIBLE_TABLE_MODEL_CHANGED, ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_ROW_HEADER_CHANGED, ACCESSIBLE_TABLE_SUMMARY_CHANGED, ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, accessibleDescription, accessibleName, accessibleParent
Modifier | Constructor and Description |
---|---|
protected |
MenuComponent.AccessibleAWTMenuComponent()
This is the default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAccessibleSelection(int index)
Replaces or supplements the component's selection with the
Accessible child at the supplied index. |
void |
addFocusListener(FocusListener listener)
Registers the specified focus listener to receive
focus events from this component.
|
void |
clearAccessibleSelection()
Clears the component's current selection.
|
boolean |
contains(Point point)
Returns true if the specified point lies within the
component.
|
Accessible |
getAccessibleAt(Point point)
Returns the
Accessible child of this component present
at the specified point. |
Accessible |
getAccessibleChild(int index)
Returns the
Accessible child at the supplied
index within the list of children of this component. |
int |
getAccessibleChildrenCount()
Returns the number of children of this component which
implement the
Accessible interface. |
AccessibleComponent |
getAccessibleComponent()
Retrieves the
AccessibleComponent associated
with this accessible context and its component. |
String |
getAccessibleDescription()
Returns the accessible name for this menu component.
|
int |
getAccessibleIndexInParent()
Retrieves the index of this component within its parent.
|
String |
getAccessibleName()
Returns the accessible name of this component.
|
Accessible |
getAccessibleParent()
Returns the
Accessible parent of this component. |
AccessibleRole |
getAccessibleRole()
Returns the accessible role of this component.
|
AccessibleSelection |
getAccessibleSelection()
Retrieves the
AccessibleSelection associated
with this accessible context and its component. |
Accessible |
getAccessibleSelection(int index)
Retrieves the
Accessible selected child
at the specified index. |
int |
getAccessibleSelectionCount()
Returns a count of the number of
Accessible
children of this component which are currently selected. |
AccessibleStateSet |
getAccessibleStateSet()
Retrieves the current state of this component
in an accessible form.
|
Color |
getBackground()
Returns the background color of the component, or null
if this property is unsupported.
|
Rectangle |
getBounds()
Returns a
Rectangle which represents the
bounds of this component. |
Cursor |
getCursor()
Returns the
Cursor displayed when the pointer
is positioned over this component. |
Font |
getFont()
Returns the
Font used for text created by this component. |
FontMetrics |
getFontMetrics(Font font)
Retrieves information on the rendering and metrics of the supplied
font.
|
Color |
getForeground()
Returns the foreground color of the component, or null
if this property is unsupported.
|
Locale |
getLocale()
Returns the locale currently in use by this component.
|
Point |
getLocation()
Returns the location of the component, with co-ordinates
relative to the parent component and using the co-ordinate
space of the screen.
|
Point |
getLocationOnScreen()
Returns the location of the component, with co-ordinates
relative to the screen.
|
Dimension |
getSize()
Returns the size of the component.
|
boolean |
isAccessibleChildSelected(int index)
Returns true if the accessible child specified by the supplied index
is currently selected.
|
boolean |
isEnabled()
Returns true if this component is currently enabled.
|
boolean |
isFocusTraversable()
Returns true if this component is included in the traversal
of the current focus from one component to the other.
|
boolean |
isShowing()
Returns true if the component is being shown on screen.
|
boolean |
isVisible()
Returns true if the component is visible.
|
void |
removeAccessibleSelection(int index)
Removes the accessible child specified by the supplied index from
the list of currently selected children.
|
void |
removeFocusListener(FocusListener listener)
Removes the specified focus listener from the list of registered
focus listeners for this component.
|
void |
requestFocus()
Requests that this component gains focus.
|
void |
selectAllAccessibleSelection()
Selects all
Accessible children of this component which
it is possible to select. |
void |
setBackground(Color color)
Sets the background color of the component to that specified.
|
void |
setBounds(Rectangle rectangle)
Sets the height and width of the component, and its position
relative to this component's parent, to the values specified
by the supplied rectangle.
|
void |
setCursor(Cursor cursor)
Sets the
Cursor used when the pointer is positioned over the
component. |
void |
setEnabled(boolean enabled)
Sets the enabled/disabled state of this component.
|
void |
setFont(Font font)
Sets the
Font used for text created by this component. |
void |
setForeground(Color color)
Sets the foreground color of the component to that specified.
|
void |
setLocation(Point point)
Sets the location of the component, with co-ordinates
relative to the parent component and using the co-ordinate
space of the screen.
|
void |
setSize(Dimension size)
Sets the size of the component.
|
void |
setVisible(boolean visibility)
Sets the visibility state of the component.
|
addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleEditableText, getAccessibleIcon, getAccessibleRelationSet, getAccessibleTable, getAccessibleText, getAccessibleValue, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent
protected MenuComponent.AccessibleAWTMenuComponent()
public void addAccessibleSelection(int index)
Accessible
child at the supplied index. If
the component supports multiple selection, the child is
added to the current selection. Otherwise, the current
selection becomes the specified child. If the child is
already selected, nothing happens.
addAccessibleSelection
in interface AccessibleSelection
index
- the index of the specified child within a
zero-based list of the component's childrenpublic void addFocusListener(FocusListener listener)
addFocusListener
in interface AccessibleComponent
listener
- the new focus listenerAccessibleComponent.removeFocusListener(FocusListener)
public void clearAccessibleSelection()
clearAccessibleSelection
in interface AccessibleSelection
public boolean contains(Point point)
getBounds()
method. Subclasses
must provide the bounding rectangle via getBounds()
in order for this method to work.contains
in interface AccessibleComponent
point
- the point to check against this componentgetBounds()
public Accessible getAccessibleAt(Point point)
Accessible
child of this component present
at the specified point. The supplied co-ordinates are
assumed to be relative to the co-ordinate system of this
component (the parent of any returned accessible). Thus,
the point (0,0) is the upper left corner of this menu
component.
getAccessibleAt
in interface AccessibleComponent
point
- the point at which the returned accessible
is locatedpublic Accessible getAccessibleChild(int index)
Accessible
child at the supplied
index within the list of children of this component.
getAccessibleChild
in class AccessibleContext
index
- the index of the Accessible
child
to retrieveAccessibleContext.getAccessibleChildrenCount()
public int getAccessibleChildrenCount()
Accessible
interface. If
all children of this component are accessible, then
the returned value will be the same as the number of
children.
getAccessibleChildrenCount
in class AccessibleContext
AccessibleContext.getAccessibleChild(int)
public AccessibleComponent getAccessibleComponent()
AccessibleComponent
associated
with this accessible context and its component. As the
context itself implements AccessibleComponent
,
this is the return value.getAccessibleComponent
in class AccessibleContext
AccessibleComponent
public String getAccessibleDescription()
setName()
.
getAccessibleDescription
in class AccessibleContext
MenuComponent.setName(String)
public int getAccessibleIndexInParent()
getAccessibleIndexInParent
in class AccessibleContext
MenuContainer
is not Accessible
AccessibleContext.getAccessibleParent()
,
AccessibleContext.getAccessibleChildrenCount()
,
AccessibleContext.getAccessibleChild(int)
public String getAccessibleName()
setName()
.
getAccessibleName
in class AccessibleContext
MenuComponent.setName(String)
public Accessible getAccessibleParent()
Accessible
parent of this component.
As the parent of a MenuComponent
is a
MenuContainer
, which doesn't implement
Accessible
, this method returns null.getAccessibleParent
in class AccessibleContext
public AccessibleRole getAccessibleRole()
AccessibleRole.AWT_COMPONENT
,
as the abstract component has no specific role. This
method should be overridden by concrete subclasses, so
as to return an appropriate role for the component.getAccessibleRole
in class AccessibleContext
AccessibleRole.AWT_COMPONENT
AccessibleRole
public AccessibleSelection getAccessibleSelection()
AccessibleSelection
associated
with this accessible context and its component. As the
context itself implements AccessibleSelection
,
this is the return value.getAccessibleSelection
in class AccessibleContext
AccessibleSelection
public Accessible getAccessibleSelection(int index)
Accessible
selected child
at the specified index. If there are no selected children
or the index is outside the range of selected children,
null is returned. Please note that the index refers
to the index of the child in the list of selected
children, and not the index of the child in
the list of all Accessible
children.
getAccessibleSelection
in interface AccessibleSelection
index
- the index of the selected Accessible
childAccessibleSelection.getAccessibleSelectionCount()
public int getAccessibleSelectionCount()
Accessible
children of this component which are currently selected.
If there are no children currently selected, 0 is returned.
getAccessibleSelectionCount
in interface AccessibleSelection
public AccessibleStateSet getAccessibleStateSet()
PropertyChangeListener
s.getAccessibleStateSet
in class AccessibleContext
AccessibleStateSet
AccessibleState
,
AccessibleStateSet
,
AccessibleContext.addPropertyChangeListener(PropertyChangeListener)
public Color getBackground()
getBackground
in interface AccessibleComponent
setBackground(java.awt.Color)
public Rectangle getBounds()
Rectangle
which represents the
bounds of this component. The returned rectangle has the
height and width of the component's bounds, and is positioned
at a location relative to this component's parent, the
MenuContainer
. null is returned if bounds
are not supported by the component.
getBounds
in interface AccessibleComponent
setBounds(java.awt.Rectangle)
public Cursor getCursor()
Cursor
displayed when the pointer
is positioned over this component. Alternatively, null
is returned if the component doesn't support the cursor
property.
getCursor
in interface AccessibleComponent
setCursor(java.awt.Cursor)
public Font getFont()
Font
used for text created by this component.getFont
in interface AccessibleComponent
setFont(java.awt.Font)
public FontMetrics getFontMetrics(Font font)
FontMetrics
. Concrete subclasses may
find it more efficient to invoke their peer class directly, if one
is available.getFontMetrics
in interface AccessibleComponent
font
- the font about which to retrieve rendering and metric
informationNullPointerException
- if the supplied font was nullAccessibleComponent.getFont()
public Color getForeground()
getForeground
in interface AccessibleComponent
setForeground(java.awt.Color)
public Locale getLocale()
getLocale
in class AccessibleContext
public Point getLocation()
getBounds()
method. Subclasses
must provide the bounding rectangle via getBounds()
in order for this method to work.getLocation
in interface AccessibleComponent
setLocation(java.awt.Point)
public Point getLocationOnScreen()
getLocationOnScreen
in interface AccessibleComponent
AccessibleComponent.getBounds()
,
AccessibleComponent.getLocation()
public Dimension getSize()
getBounds()
method. Subclasses
must provide the bounding rectangle via getBounds()
in order for this method to work.getSize
in interface AccessibleComponent
setSize(java.awt.Dimension)
public boolean isAccessibleChildSelected(int index)
isAccessibleChildSelected
in interface AccessibleSelection
index
- the index of the accessible child to check for selectionpublic boolean isEnabled()
isEnabled
in interface AccessibleComponent
setEnabled(boolean)
public boolean isFocusTraversable()
isFocusTraversable
in interface AccessibleComponent
AccessibleContext.getAccessibleStateSet()
,
AccessibleState.FOCUSABLE
,
AccessibleState.FOCUSED
public boolean isShowing()
isShowing
in interface AccessibleComponent
isVisible()
public boolean isVisible()
isShowing()
should be
used.
isVisible
in interface AccessibleComponent
isShowing()
,
setVisible(boolean)
public void removeAccessibleSelection(int index)
removeAccessibleSelection
in interface AccessibleSelection
index
- the index of the Accessible
childpublic void removeFocusListener(FocusListener listener)
removeFocusListener
in interface AccessibleComponent
listener
- the listener to removeAccessibleComponent.addFocusListener(FocusListener)
public void requestFocus()
requestFocus
in interface AccessibleComponent
AccessibleComponent.isFocusTraversable()
,
AccessibleState.FOCUSED
public void selectAllAccessibleSelection()
Accessible
children of this component which
it is possible to select. The component needs to support multiple
selections.
addAccessibleSelection
to
add each Accessible
child to the selection. The last
Accessible
component is thus selected for components
which don't support multiple selections. Concrete implementations should
override this with a more appopriate and efficient implementation, which
properly takes into account the ability of the component to support multiple
selections.selectAllAccessibleSelection
in interface AccessibleSelection
public void setBackground(Color color)
setBackground
in interface AccessibleComponent
color
- the new color to use for the backgroundgetBackground()
public void setBounds(Rectangle rectangle)
getBounds()
.
Concrete subclasses which handle the drawing of an onscreen
menu component should override this method and provide
the appropriate information.setBounds
in interface AccessibleComponent
rectangle
- a rectangle which specifies the new bounds of
the componentgetBounds()
public void setCursor(Cursor cursor)
Cursor
used when the pointer is positioned over the
component. Unspecified behaviour occurs when null is given as the new
cursor.
setCursor
in interface AccessibleComponent
cursor
- the new cursor to usegetCursor()
public void setEnabled(boolean enabled)
setEnabled
in interface AccessibleComponent
enabled
- true if the component should be enabled,
false otherwiseisEnabled()
public void setFont(Font font)
Font
used for text created by this component.
Unspecified behaviour occurs when null is given as the new
font.setFont
in interface AccessibleComponent
font
- the new font to use for text.getFont()
public void setForeground(Color color)
setForeground
in interface AccessibleComponent
color
- the new foreground colorgetForeground()
public void setLocation(Point point)
getBounds()
method. Subclasses
must provide the bounding rectangle via getBounds()
in order for this method to work.setLocation
in interface AccessibleComponent
point
- the location of the component, relative to its parentgetLocation()
public void setSize(Dimension size)
getBounds()
method. Subclasses
must provide the bounding rectangle via getBounds()
in order for this method to work.setSize
in interface AccessibleComponent
size
- the new size of the componentgetSize()
public void setVisible(boolean visibility)
isShowing()
should be
used.
setVisible
in interface AccessibleComponent
visibility
- the new visibility of the component -- true if
the component is visible, false if notisShowing()
,
isVisible()