selectedText
Returns the complete retained selection's text on the EDT, or null when unavailable.
Includes offscreen rows and closed-session output. Reads current session content, joining soft-wrapped rows for linear selections and preserving row breaks for block selections. Wide cells and grapheme clusters are copied completely. A nonempty selection may return an empty string when only trimmed blanks remain. Unbound and disposed components return null.
Uses the same extraction as copySelectionToClipboard without accessing the clipboard, scrolling, focusing, or sending input. Eviction may clip selection; invalidated layouts or buffer changes clear it. Resulting selection changes notify listeners outside the frame lease. The returned string may be retained.
Throws
outside the EDT.