The Translator class provides a translation to interface
Accessible
for objects that do not implement interface Accessible. Assistive
technologies can use the getAccessible class method of
Translator to obtain an object that implements interface Accessible.
If the object passed in already implements interface Accessible,
getAccessible merely returns the object.
An example of how an assistive technology might use the Translator
class is as follows:
Accessible accessible = Translator.getAccessible(someObj); // obtain information from the 'accessible' object.
Note
This implementation is missing many things and is not a recommended way
to implement accessibility features for a toolkit. Instead of relying upon this
code, a toolkit's components should implement interface Accessible directly.
| Modifier and Type | Field and Description |
|---|---|
| protected Object | source
The source object needing translating. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | Translator(Object
the Component that does not implement interface
o)AccessibleCreate a new |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addFocusListener(FocusListener
the focus listener l)Implements javax. Adds the specified |
| public void | addPropertyChangeListener(PropertyChangeListener l)
Overrides javax. Add a |
| public boolean | Returns: true if object containsPoint; otherwise falsethe p)Point relative to the coordinate system of the objectImplements javax. Checks whether the specified |
| public boolean | Returns: true if this is the same objectthe o)Object to check againstOverrides java. Returns true if this object is the same as the one passed in. |
| public static Accessible | Returns: anObject, possibly the Object passed in, that
implements the Accessible interface for the Object
which was passed inan Object; if a null is passed in a null is returned o)Obtain an object that implements interface |
| public Accessible | Returns: the Accessible at the specified location, if it existsImplements javax. Returns the accessible child contained at the local coordinate Point, if one exists. |
| public Accessible | Returns: the nth accessible child of the objectzero-based index of child i)Implements abstract javax. Return the nth accessible child of the object. |
| public int | Returns: the number of accessible children in the objectImplements abstract javax. Returns the number of accessible children in the object. |
| public AccessibleContext | getAccessibleContext()
Implements javax. Returns this object. |
| public String | Returns: the description of the object; can be null if this object does not have a descriptionOverrides javax. Get the accessible description of this object. |
| public int | Returns: -1 of this object does not have an accessible parent; otherwise, the index of the child in its accessible parentImplements abstract javax. Get the index of this object in its accessible parent. |
| public String | Returns: the localized name of the object; can be null if this object does not have a nameOverrides javax. Get the accessible name of this object. |
| public Accessible | Returns: the accessible parent of this object; can be null if this object does not have an accessible parentOverrides javax. Get the accessible parent of this object. |
| public AccessibleRole | Returns: an instance of AccessibleRole describing the role of the objectImplements abstract javax. Get the role of this object. |
| public AccessibleStateSet | Returns: an instance ofAccessibleStateSet
containing the current state of the objectImplements abstract javax. Get the state of this object, given an already populated state. |
| public Color | Returns: if supported, the backgroundColor of the object;
otherwise, nullImplements javax. Get the background |
| public Rectangle | Returns: current bounds of object; can be null if this object is not on the screenImplements javax. Returns the current bounds of this object. |
| public Cursor | Returns: if supported, the Cursor of the object; otherwise, nullImplements javax. Get the |
| public Font | Returns: if supported, theFont for the object; otherwise, nullImplements javax. Get the |
| public FontMetrics | Returns: if supported, theFontMetrics the object; otherwise, nullthe f)FontImplements javax. Get the |
| public Color | Returns: if supported, the foregroundColor of the object; otherwise, nullImplements javax. Get the foreground |
| public Locale | Returns: theLocale of the objectImplements abstract javax. Gets the |
| public Point | Returns: location of object relative to parent; can be null if this object or its parent are not on the screenImplements javax. Returns the location of the object relative to parent. |
| public Point | Returns: location of object on screen; can be null if this object is not on the screenImplements javax. Returns the location of the object on the screen. |
| public Dimension | Returns: current size of object; can be null if this object is not on the screenImplements javax. Returns the current size of this object. |
| public Object | |
| protected static Class | Returns: theTranslator Class for the Class passed ina Class c)Find a translator for this class. |
| public int | |
| public boolean | Returns: true if object is enabled; otherwise, falseImplements javax. Determine if the object is enabled. |
| public boolean | Returns: true if object can accept focus; otherwise falseImplements javax. Returns whether this object can accept focus or not. |
| public boolean | Returns: true if object is showing; otherwise, falseImplements javax. Determine if the object is showing. |
| public boolean | Returns: true if object is visible; otherwise, falseImplements javax. Determine if the object is visible. |
| public synchronized void | removeFocusListener(FocusListener
the focus listener; this method performs no function, nor does it
throw an exception if the listener specified was not previously added
to this component; if listener is null, no exception is thrown and no
action is performed. l)Implements javax. Removes the specified focus listener so it no longer receives focus events from this component. |
| public void | removePropertyChangeListener(PropertyChangeListener l)
Overrides javax. Remove the |
| public void | requestFocus()
Implements javax. Requests focus for this object. |
| public void | setAccessibleDescription(String
the new localized description of the object s)Overrides javax. Set the accessible description of this object. |
| public void | setAccessibleName(String s)
Overrides javax. Set the name of this object. |
| public void | setBackground(Color
the new c)Color for the backgroundImplements javax. Set the background |
| public void | setBounds(Rectangle r)
Implements javax. Sets the current bounds of this object. |
| public void | setCursor(Cursor
the new c)Cursor for the objectImplements javax. Set the |
| public void | setEnabled(boolean
if true, enables this object; otherwise, disables it b)Implements javax. Set the enabled state of the object. |
| public void | setFont(Font
the new f)Font for the objectImplements javax. Set the |
| public void | setForeground(Color
the new c)Color for the foregroundImplements javax. Set the foreground |
| public void | setLocation(Point p)
Implements javax. Sets the location of the object relative to parent. |
| public void | setSize(Dimension d)
Implements javax. Sets the current size of this object. |
| public void | |
| public void | setVisible(boolean
if true, shows this object; otherwise, hides it b)Implements javax. Set the visible state of the object. |
| source | back to summary |
|---|---|
| protected Object source The source object needing translating. | |
| Translator | back to summary |
|---|---|
| public Translator() Create a new | |
| Translator | back to summary |
|---|---|
| public Translator(Object o) Create a new
| |
| addFocusListener | back to summary |
|---|---|
| public synchronized void addFocusListener(FocusListener l) Implements javax. Adds the specified
| |
| addPropertyChangeListener | back to summary |
|---|---|
| public void addPropertyChangeListener(PropertyChangeListener l) Overrides javax. Add a | |
| contains | back to summary |
|---|---|
| public boolean contains(Point p) Implements javax. Checks whether the specified
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Returns true if this object is the same as the one passed in.
| |
| getAccessible | back to summary |
|---|---|
| public static Accessible getAccessible(Object o) Obtain an object that implements interface
| |
| getAccessibleAt | back to summary |
|---|---|
| public Accessible getAccessibleAt(Point p) Implements javax. Returns the accessible child contained at the local coordinate Point, if one exists.
| |
| getAccessibleChild | back to summary |
|---|---|
| public Accessible getAccessibleChild(int i) Implements abstract javax. Return the nth accessible child of the object.
| |
| getAccessibleChildrenCount | back to summary |
|---|---|
| public int getAccessibleChildrenCount() Implements abstract javax. Returns the number of accessible children in the object.
| |
| getAccessibleContext | back to summary |
|---|---|
| public AccessibleContext getAccessibleContext() Implements javax. Returns this object. | |
| getAccessibleDescription | back to summary |
|---|---|
| public String getAccessibleDescription() Overrides javax. Get the accessible description of this object.
| |
| getAccessibleIndexInParent | back to summary |
|---|---|
| public int getAccessibleIndexInParent() Implements abstract javax. Get the index of this object in its accessible parent.
| |
| getAccessibleName | back to summary |
|---|---|
| public String getAccessibleName() Overrides javax. Get the accessible name of this object.
| |
| getAccessibleParent | back to summary |
|---|---|
| public Accessible getAccessibleParent() Overrides javax. Get the accessible parent of this object.
| |
| getAccessibleRole | back to summary |
|---|---|
| public AccessibleRole getAccessibleRole() Implements abstract javax. Get the role of this object.
| |
| getAccessibleStateSet | back to summary |
|---|---|
| public AccessibleStateSet getAccessibleStateSet() Implements abstract javax. Get the state of this object, given an already populated state. This method is intended for use by subclasses so they don't have to check for everything.
| |
| getBackground | back to summary |
|---|---|
| public Color getBackground() Implements javax. Get the background
| |
| getBounds | back to summary |
|---|---|
| public Rectangle getBounds() Implements javax. Returns the current bounds of this object.
| |
| getCursor | back to summary |
|---|---|
| public Cursor getCursor() Implements javax. Get the
| |
| getFont | back to summary |
|---|---|
| public Font getFont() Implements javax. Get the
| |
| getFontMetrics | back to summary |
|---|---|
| public FontMetrics getFontMetrics(Font f) Implements javax. Get the
| |
| getForeground | back to summary |
|---|---|
| public Color getForeground() Implements javax. Get the foreground
| |
| getLocale | back to summary |
|---|---|
| public Locale getLocale() throws IllegalComponentStateException Implements abstract javax. Gets the
| |
| getLocation | back to summary |
|---|---|
| public Point getLocation() Implements javax. Returns the location of the object relative to parent.
| |
| getLocationOnScreen | back to summary |
|---|---|
| public Point getLocationOnScreen() Implements javax. Returns the location of the object on the screen.
| |
| getSize | back to summary |
|---|---|
| public Dimension getSize() Implements javax. Returns the current size of this object.
| |
| getSource | back to summary |
|---|---|
| public Object getSource() Get the source
| |
| getTranslatorClass | back to summary |
|---|---|
| protected static Class Find a translator for this class. If one doesn't exist for this class explicitly, try its superclass and so on. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Return hashcode.
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled() Implements javax. Determine if the object is enabled.
| |
| isFocusTraversable | back to summary |
|---|---|
| public boolean isFocusTraversable() Implements javax. Returns whether this object can accept focus or not.
| |
| isShowing | back to summary |
|---|---|
| public boolean isShowing() Implements javax. Determine if the object is showing. This is determined by checking the visibility of the object and ancestors of the object.
| |
| isVisible | back to summary |
|---|---|
| public boolean isVisible() Implements javax. Determine if the object is visible.
| |
| removeFocusListener | back to summary |
|---|---|
| public synchronized void removeFocusListener(FocusListener l) Implements javax. Removes the specified focus listener so it no longer receives focus events from this component.
| |
| removePropertyChangeListener | back to summary |
|---|---|
| public void removePropertyChangeListener(PropertyChangeListener l) Overrides javax. Remove the | |
| requestFocus | back to summary |
|---|---|
| public void requestFocus() Implements javax. Requests focus for this object. | |
| setAccessibleDescription | back to summary |
|---|---|
| public void setAccessibleDescription(String s) Overrides javax. Set the accessible description of this object.
| |
| setAccessibleName | back to summary |
|---|---|
| public void setAccessibleName(String s) Overrides javax. Set the name of this object. | |
| setBackground | back to summary |
|---|---|
| public void setBackground(Color c) Implements javax. Set the background
| |
| setBounds | back to summary |
|---|---|
| public void setBounds(Rectangle r) Implements javax. Sets the current bounds of this object. | |
| setCursor | back to summary |
|---|---|
| public void setCursor(Cursor c) Implements javax. Set the
| |
| setEnabled | back to summary |
|---|---|
| public void setEnabled(boolean b) Implements javax. Set the enabled state of the object.
| |
| setFont | back to summary |
|---|---|
| public void setFont(Font f) Implements javax. Set the
| |
| setForeground | back to summary |
|---|---|
| public void setForeground(Color c) Implements javax. Set the foreground
| |
| setLocation | back to summary |
|---|---|
| public void setLocation(Point p) Implements javax. Sets the location of the object relative to parent. | |
| setSize | back to summary |
|---|---|
| public void setSize(Dimension d) Implements javax. Sets the current size of this object. | |
| setSource | back to summary |
|---|---|
| public void setSource(Object o) Set the source object of the
| |
| setVisible | back to summary |
|---|---|
| public void setVisible(boolean b) Implements javax. Set the visible state of the object.
| |