AccessibleRelation (Java SE 26 & JDK 26)
Description: declaration: module: java.desktop, package: javax.accessibility, class: AccessibleRelation
Keywords: javax.accessibility.AccessibleRelation class

# Class AccessibleRelation

java.lang.Object
javax.accessibility.AccessibleBundle
javax.accessibility.AccessibleRelation

public class AccessibleRelation extends AccessibleBundle
Class `AccessibleRelation` describes a relation between the object that implements the `AccessibleRelation` and one or more other objects. The actual relations that an object has with other objects are defined as an `AccessibleRelationSet`, which is a composed set of `AccessibleRelations`.

The `AccessibleBundle.toDisplayString()` method allows you to obtain the localized string for a locale independent key from a predefined `ResourceBundle` for the keys defined in this class.

The constants in this class present a strongly typed enumeration of common object roles. If the constants in this class are not sufficient to describe the role of an object, a subclass should be generated from this class and it should provide constants in a similar manner.

Since:
  1.3

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CHILD_NODE_OF`
  Indicates that an object is a child node of one or more objects.
  `static final String`
  `CHILD_NODE_OF_PROPERTY`
  Indicates the `CHILD_NODE_OF` relation between two or more objects has changed.
  `static final String`
  `CONTROLLED_BY`
  Indicates an object is controlled by one or more target objects.
  `static final String`
  `CONTROLLED_BY_PROPERTY`
  Identifies that the target object that is doing the controlling has changed.
  `static final String`
  `CONTROLLER_FOR`
  Indicates an object is a controller for one or more target objects.
  `static final String`
  `CONTROLLER_FOR_PROPERTY`
  Identifies that the controller for the target object has changed.
  `static final String`
  `EMBEDDED_BY`
  Indicates that an object is embedded in one or more objects.
  `static final String`
  `EMBEDDED_BY_PROPERTY`
  Indicates the `EMBEDDED_BY` relation between two or more objects has changed.
  `static final String`
  `EMBEDS`
  Indicates that an object has one or more objects embedded in it.
  `static final String`
  `EMBEDS_PROPERTY`
  Indicates the `EMBEDS` relation between two or more objects has changed.
  `static final String`
  `FLOWS_FROM`
  Indicates an object is logically contiguous with a second object where the second object occurs before the object.
  `static final String`
  `FLOWS_FROM_PROPERTY`
  Indicates the `FLOWS_FROM` relation between two objects has changed.
  `static final String`
  `FLOWS_TO`
  Indicates an object is logically contiguous with a second object where the second object occurs after the object.
  `static final String`
  `FLOWS_TO_PROPERTY`
  Indicates the `FLOWS_TO` relation between two objects has changed.
  `static final String`
  `LABEL_FOR`
  Indicates an object is a label for one or more target objects.
  `static final String`
  `LABEL_FOR_PROPERTY`
  Identifies that the target group for a label has changed.
  `static final String`
  `LABELED_BY`
  Indicates an object is labeled by one or more target objects.
  `static final String`
  `LABELED_BY_PROPERTY`
  Identifies that the objects that are doing the labeling have changed.
  `static final String`
  `MEMBER_OF`
  Indicates an object is a member of a group of one or more target objects.
  `static final String`
  `MEMBER_OF_PROPERTY`
  Identifies that group membership has changed.
  `static final String`
  `PARENT_WINDOW_OF`
  Indicates that an object is a parent window of one or more objects.
  `static final String`
  `PARENT_WINDOW_OF_PROPERTY`
  Indicates the `PARENT_WINDOW_OF` relation between two or more objects has changed.
  `static final String`
  `SUBWINDOW_OF`
  Indicates that an object is a subwindow of one or more objects.
  `static final String`
  `SUBWINDOW_OF_PROPERTY`
  Indicates the `SUBWINDOW_OF` relation between two or more objects has changed.

  ### Fields declared in class AccessibleBundle

  `key`
  Modifier and Type
  Field
  Description
  `protected String`
  `key`
  The locale independent name of the state.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AccessibleRelation(String key)`
  Create a new `AccessibleRelation` using the given locale independent key.
  `AccessibleRelation(String key, Object target)`
  Creates a new `AccessibleRelation` using the given locale independent key.
  `AccessibleRelation(String key, Object[] target)`
  Creates a new `AccessibleRelation` using the given locale independent key.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getKey()`
  Returns the key for this relation.
  `Object[]`
  `getTarget()`
  Returns the target objects for this relation.
  `void`
  `setTarget(Object target)`
  Sets the target object for this relation.
  `void`
  `setTarget(Object[] target)`
  Sets the target objects for this relation.

  ### Methods declared in class AccessibleBundle

  `toDisplayString, toDisplayString, toDisplayString, toString`
  Modifier and Type
  Method
  Description
  `String`
  `toDisplayString()`
  Gets localized string describing the key using the default locale.
  `protected String`
  `toDisplayString(String name, Locale locale)`
  Obtains the key as a localized string.
  `String`
  `toDisplayString(Locale locale)`
  Obtains the key as a localized string.
  `String`
  `toString()`
  Gets localized string describing the key using the default locale.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Field Details

  - ### LABEL_FOR

    public static final String LABEL_FOR
    Indicates an object is a label for one or more target objects.
    See Also:
      - `getTarget()`
      - `CONTROLLER_FOR`
      - `CONTROLLED_BY`
      - `LABELED_BY`
      - `MEMBER_OF`

  - ### LABELED_BY

    public static final String LABELED_BY
    Indicates an object is labeled by one or more target objects.
    See Also:
      - `getTarget()`
      - `CONTROLLER_FOR`
      - `CONTROLLED_BY`
      - `LABEL_FOR`
      - `MEMBER_OF`

  - ### MEMBER_OF

    public static final String MEMBER_OF
    Indicates an object is a member of a group of one or more target objects.
    See Also:
      - `getTarget()`
      - `CONTROLLER_FOR`
      - `CONTROLLED_BY`
      - `LABEL_FOR`
      - `LABELED_BY`

  - ### CONTROLLER_FOR

    public static final String CONTROLLER_FOR
    Indicates an object is a controller for one or more target objects.
    See Also:
      - `getTarget()`
      - `CONTROLLED_BY`
      - `LABEL_FOR`
      - `LABELED_BY`
      - `MEMBER_OF`

  - ### CONTROLLED_BY

    public static final String CONTROLLED_BY
    Indicates an object is controlled by one or more target objects.
    See Also:
      - `getTarget()`
      - `CONTROLLER_FOR`
      - `LABEL_FOR`
      - `LABELED_BY`
      - `MEMBER_OF`

  - ### FLOWS_TO

    public static final String FLOWS_TO
    Indicates an object is logically contiguous with a second object where the second object occurs after the object. An example is a paragraph of text that runs to the end of a page and continues on the next page with an intervening text footer and/or text header. The two parts of the paragraph are separate text elements but are related in that the second element is a continuation of the first element. In other words, the first element "flows to" the second element.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### FLOWS_FROM

    public static final String FLOWS_FROM
    Indicates an object is logically contiguous with a second object where the second object occurs before the object. An example is a paragraph of text that runs to the end of a page and continues on the next page with an intervening text footer and/or text header. The two parts of the paragraph are separate text elements but are related in that the second element is a continuation of the first element. In other words, the second element "flows from" the second element.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### SUBWINDOW_OF

    public static final String SUBWINDOW_OF
    Indicates that an object is a subwindow of one or more objects.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### PARENT_WINDOW_OF

    public static final String PARENT_WINDOW_OF
    Indicates that an object is a parent window of one or more objects.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### EMBEDS

    public static final String EMBEDS
    Indicates that an object has one or more objects embedded in it.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### EMBEDDED_BY

    public static final String EMBEDDED_BY
    Indicates that an object is embedded in one or more objects.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### CHILD_NODE_OF

    public static final String CHILD_NODE_OF
    Indicates that an object is a child node of one or more objects.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### LABEL_FOR_PROPERTY

    public static final String LABEL_FOR_PROPERTY
    Identifies that the target group for a label has changed.
    See Also:
      - Constant Field Values

  - ### LABELED_BY_PROPERTY

    public static final String LABELED_BY_PROPERTY
    Identifies that the objects that are doing the labeling have changed.
    See Also:
      - Constant Field Values

  - ### MEMBER_OF_PROPERTY

    public static final String MEMBER_OF_PROPERTY
    Identifies that group membership has changed.
    See Also:
      - Constant Field Values

  - ### CONTROLLER_FOR_PROPERTY

    public static final String CONTROLLER_FOR_PROPERTY
    Identifies that the controller for the target object has changed.
    See Also:
      - Constant Field Values

  - ### CONTROLLED_BY_PROPERTY

    public static final String CONTROLLED_BY_PROPERTY
    Identifies that the target object that is doing the controlling has changed.
    See Also:
      - Constant Field Values

  - ### FLOWS_TO_PROPERTY

    public static final String FLOWS_TO_PROPERTY
    Indicates the `FLOWS_TO` relation between two objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### FLOWS_FROM_PROPERTY

    public static final String FLOWS_FROM_PROPERTY
    Indicates the `FLOWS_FROM` relation between two objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### SUBWINDOW_OF_PROPERTY

    public static final String SUBWINDOW_OF_PROPERTY
    Indicates the `SUBWINDOW_OF` relation between two or more objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### PARENT_WINDOW_OF_PROPERTY

    public static final String PARENT_WINDOW_OF_PROPERTY
    Indicates the `PARENT_WINDOW_OF` relation between two or more objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### EMBEDS_PROPERTY

    public static final String EMBEDS_PROPERTY
    Indicates the `EMBEDS` relation between two or more objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### EMBEDDED_BY_PROPERTY

    public static final String EMBEDDED_BY_PROPERTY
    Indicates the `EMBEDDED_BY` relation between two or more objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

  - ### CHILD_NODE_OF_PROPERTY

    public static final String CHILD_NODE_OF_PROPERTY
    Indicates the `CHILD_NODE_OF` relation between two or more objects has changed.
    Since:
      1.5
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AccessibleRelation

    public AccessibleRelation(String key)
    Create a new `AccessibleRelation` using the given locale independent key. The key `String` should be a locale independent key for the relation. It is not intended to be used as the actual `String` to display to the user. To get the localized string, use `AccessibleBundle.toDisplayString()`.
    Parameters:
      `key` - the locale independent name of the relation
    See Also:
      - `AccessibleBundle.toDisplayString(String, Locale)`

  - ### AccessibleRelation

    public AccessibleRelation(String key, Object target)
    Creates a new `AccessibleRelation` using the given locale independent key. The key `String` should be a locale independent key for the relation. It is not intended to be used as the actual `String` to display to the user. To get the localized string, use `AccessibleBundle.toDisplayString()`.
    Parameters:
      `key` - the locale independent name of the relation
      `target` - the target object for this relation
    See Also:
      - `AccessibleBundle.toDisplayString(String, Locale)`

  - ### AccessibleRelation

    public AccessibleRelation(String key, Object[] target)
    Creates a new `AccessibleRelation` using the given locale independent key. The key `String` should be a locale independent key for the relation. It is not intended to be used as the actual `String` to display to the user. To get the localized string, use `AccessibleBundle.toDisplayString()`.
    Parameters:
      `key` - the locale independent name of the relation
      `target` - the target object(s) for this relation
    See Also:
      - `AccessibleBundle.toDisplayString(String, Locale)`

- ## Method Details

  - ### getKey

    public String getKey()
    Returns the key for this relation.
    Returns:
      the key for this relation
    See Also:
      - `CONTROLLER_FOR`
      - `CONTROLLED_BY`
      - `LABEL_FOR`
      - `LABELED_BY`
      - `MEMBER_OF`

  - ### getTarget

    public Object[] getTarget()
    Returns the target objects for this relation.
    Returns:
      an array containing the target objects for this relation

  - ### setTarget

    public void setTarget(Object target)
    Sets the target object for this relation.
    Parameters:
      `target` - the target object for this relation

  - ### setTarget

    public void setTarget(Object[] target)
    Sets the target objects for this relation.
    Parameters:
      `target` - an array containing the target objects for this relation