gpt4 book ai didi

java - 如何使用文本 Action

转载 作者:搜寻专家 更新时间:2023-10-31 19:34:38 25 4
gpt4 key购买 nike

使用TextAction的目的是什么?来自 AbstractAction ?以及如何将其用于以下用途:

最佳答案

来自 Java Swing 2nd Edition :

All text components share a set of default Actions. Each of these Actions are instances of TextAction by default. JTextComponent provides a private static EditorKit which consists of a set of four pre-built TextActions shared by all text components through the use of a default Keymap instance.

JTextComponent maintains a private reference to the text component that most recently had the keyboard focus. TextActions are designed to take advantage of this, and each TextAction will operate on this component when it’s invoked in the event that the source of the invoking event is not a text component.

下面是一些实现 TextAction 的例子:

Custom Editing Command

Finding Word Boundaries

关于java - 如何使用文本 Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10075147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com