Example usage for javax.accessibility AccessibleText getSelectedText

List of usage examples for javax.accessibility AccessibleText getSelectedText

Introduction

In this page you can find the example usage for javax.accessibility AccessibleText getSelectedText.

Prototype

public String getSelectedText();

Source Link

Document

Returns the portion of the text that is selected.

Usage

From source file:MainClass.java

void dumpTextInfo(AccessibleContext ac) {
    AccessibleText at = ac.getAccessibleText();

    if (at != null) {
        System.out.println("Caret position = " + at.getCaretPosition());
        System.out.println("Selected text = " + at.getSelectedText());

        return;//from   w  w  w .  j  ava  2  s .  c om
    }

    int nChildren = ac.getAccessibleChildrenCount();

    for (int i = 0; i < nChildren; i++)
        dumpTextInfo(ac.getAccessibleChild(i).getAccessibleContext());
}