|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class MenuComponent.AccessibleAWTMenuComponent

java.lang.Objectjavax.accessibility.AccessibleContext
java.awt.MenuComponent.AccessibleAWTMenuComponent
- All Implemented Interfaces:
- javax.accessibility.AccessibleComponent, javax.accessibility.AccessibleSelection, java.io.Serializable
- Direct Known Subclasses:
- MenuBar.AccessibleAWTMenuBar, MenuItem.AccessibleAWTMenuItem
- Enclosing class:
- MenuComponent
- protected abstract class MenuComponent.AccessibleAWTMenuComponent
- extends javax.accessibility.AccessibleContext
- implements java.io.Serializable, javax.accessibility.AccessibleComponent, javax.accessibility.AccessibleSelection
- extends javax.accessibility.AccessibleContext
This class provides a base for the accessibility support of menu components.
| Field Summary | |
private static long |
serialVersionUID
Compatible with JDK 1.4.2 revision 5 |
| Constructor Summary | |
protected |
MenuComponent.AccessibleAWTMenuComponent()
This is the default constructor. |
| Method Summary | |
void |
addAccessibleSelection(int index)
Replaces or supplements the component's selection with the Accessible child at the supplied index. |
void |
addFocusListener(java.awt.event.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. |
javax.accessibility.Accessible |
getAccessibleAt(Point point)
Returns the Accessible child of this component present
at the specified point. |
javax.accessibility.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. |
javax.accessibility.AccessibleComponent |
getAccessibleComponent()
Retrieves the AccessibleComponent associated
with this accessible context and its component. |
java.lang.String |
getAccessibleDescription()
Returns the accessible name for this menu component. |
int |
getAccessibleIndexInParent()
Retrieves the index of this component within its parent. |
java.lang.String |
getAccessibleName()
Returns the accessible name of this component. |
javax.accessibility.Accessible |
getAccessibleParent()
Returns the Accessible parent of this component. |
javax.accessibility.AccessibleRole |
getAccessibleRole()
Returns the accessible role of this component. |
javax.accessibility.AccessibleSelection |
getAccessibleSelection()
Retrieves the AccessibleSelection associated
with this accessible context and its component. |
javax.accessibility.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. |
javax.accessibility.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. |
java.util.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(java.awt.event.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. |
| Methods inherited from class javax.accessibility.AccessibleContext |
addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleEditableText, getAccessibleIcon, getAccessibleRelationSet, getAccessibleTable, getAccessibleText, getAccessibleValue, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- Compatible with JDK 1.4.2 revision 5
- See Also:
- Constant Field Values
| Constructor Detail |
MenuComponent.AccessibleAWTMenuComponent
protected MenuComponent.AccessibleAWTMenuComponent()
- This is the default constructor. It should be called by
concrete subclasses to ensure necessary groundwork is completed.
| Method Detail |
addAccessibleSelection
public void addAccessibleSelection(int index)
- Replaces or supplements the component's selection with the
Accessiblechild 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.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
addAccessibleSelectionin interfacejavax.accessibility.AccessibleSelection
addFocusListener
public void addFocusListener(java.awt.event.FocusListener listener)
- Registers the specified focus listener to receive
focus events from this component.
- Specified by:
addFocusListenerin interfacejavax.accessibility.AccessibleComponent
clearAccessibleSelection
public void clearAccessibleSelection()
- Clears the component's current selection. Following
the calling of this method, no children of the component
will be selected.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
clearAccessibleSelectionin interfacejavax.accessibility.AccessibleSelection
contains
public boolean contains(Point point)
- Returns true if the specified point lies within the
component. The supplied co-ordinates are assumed to
be relative to the co-ordinate system of the component
itself. Thus, the point (0,0) is the upper left corner
of this component.
Please note that this method depends on a correctly implemented version of thegetBounds()method. Subclasses must provide the bounding rectangle viagetBounds()in order for this method to work.- Specified by:
containsin interfacejavax.accessibility.AccessibleComponent
getAccessibleAt
public javax.accessibility.Accessible getAccessibleAt(Point point)
- Returns the
Accessiblechild 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.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
getAccessibleAtin interfacejavax.accessibility.AccessibleComponent
getAccessibleChild
public javax.accessibility.Accessible getAccessibleChild(int index)
- Returns the
Accessiblechild at the supplied index within the list of children of this component.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.
getAccessibleChildrenCount
public int getAccessibleChildrenCount()
- Returns the number of children of this component which
implement the
Accessibleinterface. If all children of this component are accessible, then the returned value will be the same as the number of children.
getAccessibleComponent
public javax.accessibility.AccessibleComponent getAccessibleComponent()
- Retrieves the
AccessibleComponentassociated with this accessible context and its component. As the context itself implementsAccessibleComponent, this is the return value.
getAccessibleDescription
public java.lang.String getAccessibleDescription()
- Returns the accessible name for this menu component. This
is the name given to the component, which may be null if
not set using
setName().
The name is not the most appropriate description of this object. Subclasses should preferably provide a more accurate description. For example, a File menu could have the description `Lists commands related to the file system'.
getAccessibleIndexInParent
public int getAccessibleIndexInParent()
- Retrieves the index of this component within its parent.
If no parent exists, -1 is returned.
getAccessibleName
public java.lang.String getAccessibleName()
- Returns the accessible name of this component. This
is the name given to the component, which may be null if
not set using
setName().
The name property is not the most suitable string to return for this method. The string should be localized, and relevant to the operation of the component. For example, it could be the text of a menu item. However, this can not be used at this level of abstraction, so it is the responsibility of subclasses to provide a more appropriate name.
getAccessibleParent
public javax.accessibility.Accessible getAccessibleParent()
- Returns the
Accessibleparent of this component. As the parent of aMenuComponentis aMenuContainer, which doesn't implementAccessible, this method returns null.
getAccessibleRole
public javax.accessibility.AccessibleRole getAccessibleRole()
- Returns the accessible role of this component.
The abstract implementation of this method returnsAccessibleRole.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.
getAccessibleSelection
public javax.accessibility.AccessibleSelection getAccessibleSelection()
- Retrieves the
AccessibleSelectionassociated with this accessible context and its component. As the context itself implementsAccessibleSelection, this is the return value.
getAccessibleSelection
public javax.accessibility.Accessible getAccessibleSelection(int index)
- Retrieves the
Accessibleselected 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 allAccessiblechildren.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
getAccessibleSelectionin interfacejavax.accessibility.AccessibleSelection
getAccessibleSelectionCount
public int getAccessibleSelectionCount()
- Returns a count of the number of
Accessiblechildren of this component which are currently selected. If there are no children currently selected, 0 is returned.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
getAccessibleSelectionCountin interfacejavax.accessibility.AccessibleSelection
getAccessibleStateSet
public javax.accessibility.AccessibleStateSet getAccessibleStateSet()
- Retrieves the current state of this component
in an accessible form. For example, a given component
may be visible, selected, disabled, etc.
As this class tells us virtually nothing about the component, except for its name and font, no state information can be provided. This implementation thus returns an empty state set, and it is left to concrete subclasses to provide a more acceptable and relevant state set. Changes to these properties also need to be handled usingPropertyChangeListeners.
getBackground
public Color getBackground()
- Returns the background color of the component, or null
if this property is unsupported.
This abstract class knows nothing about how the component is drawn on screen, so this method simply returns the default system background color used for rendering menus. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
getBackgroundin interfacejavax.accessibility.AccessibleComponent
getBounds
public Rectangle getBounds()
- Returns a
Rectanglewhich 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, theMenuContainer. null is returned if bounds are not supported by the component.
This abstract class knows nothing about how the component is drawn on screen, so this method simply returns null. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
getBoundsin interfacejavax.accessibility.AccessibleComponent
getCursor
public Cursor getCursor()
- Returns the
Cursordisplayed when the pointer is positioned over this component. Alternatively, null is returned if the component doesn't support the cursor property.
This abstract class knows nothing about how the component is drawn on screen, so this method simply returns the default system cursor. Concrete subclasses which handle the drawing of an onscreen menu component may override this method and provide the appropriate information.- Specified by:
getCursorin interfacejavax.accessibility.AccessibleComponent
getFont
public Font getFont()
- Returns the
Fontused for text created by this component.- Specified by:
getFontin interfacejavax.accessibility.AccessibleComponent
getFontMetrics
public FontMetrics getFontMetrics(Font font)
- Retrieves information on the rendering and metrics of the supplied
font. If font metrics are not supported by this component, null
is returned.
The abstract implementation of this method simply uses the toolkit to obtain theFontMetrics. Concrete subclasses may find it more efficient to invoke their peer class directly, if one is available.- Specified by:
getFontMetricsin interfacejavax.accessibility.AccessibleComponent
getForeground
public Color getForeground()
- Returns the foreground color of the component, or null
if this property is unsupported.
This abstract class knows nothing about how the component is drawn on screen, so this method simply returns the default system text color used for rendering menus. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
getForegroundin interfacejavax.accessibility.AccessibleComponent
getLocale
public java.util.Locale getLocale()
- Returns the locale currently in use by this component.
This abstract class has no property relating to the locale used by the component, so this method simply returns the default locale for the current instance of the Java Virtual Machine (JVM). Concrete subclasses which maintain such a property should override this method and provide the locale information more accurately.
getLocation
public 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. Thus, the point (0,0) is the upper
left corner of the parent component.
Please note that this method depends on a correctly implemented version of thegetBounds()method. Subclasses must provide the bounding rectangle viagetBounds()in order for this method to work.- Specified by:
getLocationin interfacejavax.accessibility.AccessibleComponent
getLocationOnScreen
public Point getLocationOnScreen()
- Returns the location of the component, with co-ordinates
relative to the screen. Thus, the point (0,0) is the upper
left corner of the screen. null is returned if the component
is either not on screen or if this property is unsupported.
This abstract class knows nothing about how the component is drawn on screen, so this method simply returns null. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
getLocationOnScreenin interfacejavax.accessibility.AccessibleComponent
getSize
public Dimension getSize()
- Returns the size of the component.
Please note that this method depends on a correctly implemented version of thegetBounds()method. Subclasses must provide the bounding rectangle viagetBounds()in order for this method to work.- Specified by:
getSizein interfacejavax.accessibility.AccessibleComponent
isAccessibleChildSelected
public boolean isAccessibleChildSelected(int index)
- Returns true if the accessible child specified by the supplied index
is currently selected.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
isAccessibleChildSelectedin interfacejavax.accessibility.AccessibleSelection
isEnabled
public boolean isEnabled()
- Returns true if this component is currently enabled.
As this abstract component has no properties related to its enabled or disabled state, the implementation of this method is left to subclasses.- Specified by:
isEnabledin interfacejavax.accessibility.AccessibleComponent
isFocusTraversable
public boolean isFocusTraversable()
- Returns true if this component is included in the traversal
of the current focus from one component to the other.
As this abstract component has no properties related to its ability to accept the focus, the implementation of this method is left to subclasses.- Specified by:
isFocusTraversablein interfacejavax.accessibility.AccessibleComponent
isShowing
public boolean isShowing()
- Returns true if the component is being shown on screen.
A component is determined to be shown if it is visible,
and each parent component is also visible. Please note
that, even when a component is showing, it may still be
obscured by other components in front. This method only
determines if the component is being drawn on the screen.
As this abstract component and its parent have no properties relating to visibility, the implementation of this method is left to subclasses.- Specified by:
isShowingin interfacejavax.accessibility.AccessibleComponent
isVisible
public boolean isVisible()
- Returns true if the component is visible. A component may
be visible but not drawn on the screen if one of its parent
components is not visible. To determine if the component is
actually drawn on screen,
isShowing()should be used.
As this abstract component has no properties relating to its visibility, the implementation of this method is left to subclasses.- Specified by:
isVisiblein interfacejavax.accessibility.AccessibleComponent
removeAccessibleSelection
public void removeAccessibleSelection(int index)
- Removes the accessible child specified by the supplied index from
the list of currently selected children. If the child specified
is not selected, nothing happens.
As the existence of children can not be determined from this abstract class, the implementation of this method is left to subclasses.- Specified by:
removeAccessibleSelectionin interfacejavax.accessibility.AccessibleSelection
removeFocusListener
public void removeFocusListener(java.awt.event.FocusListener listener)
- Removes the specified focus listener from the list of registered
focus listeners for this component.
- Specified by:
removeFocusListenerin interfacejavax.accessibility.AccessibleComponent
requestFocus
public void requestFocus()
- Requests that this component gains focus. This depends on the
component being focus traversable.
As this abstract component has no properties relating to its focus traversability, or access to a peer with request focusing abilities, the implementation of this method is left to subclasses.- Specified by:
requestFocusin interfacejavax.accessibility.AccessibleComponent
selectAllAccessibleSelection
public void selectAllAccessibleSelection()
- Selects all
Accessiblechildren of this component which it is possible to select. The component needs to support multiple selections.
This abstract component provides a simplistic implementation of this method, which ignores the ability of the component to support multiple selections and simply usesaddAccessibleSelectionto add eachAccessiblechild to the selection. The lastAccessiblecomponent 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.- Specified by:
selectAllAccessibleSelectionin interfacejavax.accessibility.AccessibleSelection
setBackground
public void setBackground(Color color)
- Sets the background color of the component to that specified.
Unspecified behaviour occurs when null is given as the new
background color.
This abstract class knows nothing about how the component is drawn on screen, so this method simply ignores the supplied color and continues to use the default system color. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
setBackgroundin interfacejavax.accessibility.AccessibleComponent
setBounds
public 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. Unspecified behaviour occurs when
null is given as the new bounds.
This abstract class knows nothing about how the component is drawn on screen, so this method simply ignores the new rectangle and continues to return null fromgetBounds(). Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
setBoundsin interfacejavax.accessibility.AccessibleComponent
setCursor
public void setCursor(Cursor cursor)
- Sets the
Cursorused when the pointer is positioned over the component. Unspecified behaviour occurs when null is given as the new cursor.
This abstract class knows nothing about how the component is drawn on screen, so this method simply ignores the new cursor and continues to return the default system cursor. Concrete subclasses which handle the drawing of an onscreen menu component may override this method and provide the appropriate information.- Specified by:
setCursorin interfacejavax.accessibility.AccessibleComponent
setEnabled
public void setEnabled(boolean enabled)
- Sets the enabled/disabled state of this component.
As this abstract component has no properties related to its enabled or disabled state, the implementation of this method is left to subclasses.- Specified by:
setEnabledin interfacejavax.accessibility.AccessibleComponent
setFont
public void setFont(Font font)
- Sets the
Fontused for text created by this component. Unspecified behaviour occurs when null is given as the new font.- Specified by:
setFontin interfacejavax.accessibility.AccessibleComponent
setForeground
public void setForeground(Color color)
- Sets the foreground color of the component to that specified.
Unspecified behaviour occurs when null is given as the new
background color.
This abstract class knows nothing about how the component is drawn on screen, so this method simply ignores the supplied color and continues to return the default system text color used for rendering menus. Concrete subclasses which handle the drawing of an onscreen menu component should override this method and provide the appropriate information.- Specified by:
setForegroundin interfacejavax.accessibility.AccessibleComponent
setLocation
public 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. Thus, the point (0,0) is the upper
left corner of the parent component.
Please note that this method depends on a correctly implemented version of thegetBounds()method. Subclasses must provide the bounding rectangle viagetBounds()in order for this method to work.- Specified by:
setLocationin interfacejavax.accessibility.AccessibleComponent
setSize
public void setSize(Dimension size)
- Sets the size of the component.
Please note that this method depends on a correctly implemented version of thegetBounds()method. Subclasses must provide the bounding rectangle viagetBounds()in order for this method to work.- Specified by:
setSizein interfacejavax.accessibility.AccessibleComponent
setVisible
public void setVisible(boolean visibility)
- Sets the visibility state of the component. A component may
be visible but not drawn on the screen if one of its parent
components is not visible. To determine if the component is
actually drawn on screen,
isShowing()should be used.
As this abstract component has no properties relating to its visibility, the implementation of this method is left to subclasses.- Specified by:
setVisiblein interfacejavax.accessibility.AccessibleComponent
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC