gpt4 book ai didi

java - JtextArea 中的键绑定(bind)以获取键入的文本

转载 作者:行者123 更新时间:2023-11-29 03:22:18 24 4
gpt4 key购买 nike

有什么方法可以在 java 中使用 keybindings 来获取我在 JTextArea 中键入的文本在字符串变量中??

例如,如果我在 JtextArea 中键入“Stack overflow”,使用键绑定(bind)我需要在字符串变量中获取“stack overflow”。

我可以使用 keyListeners(通过按键事件)做到这一点,我怎样才能在键绑定(bind)中实现它?

我已经为一些键实现了键绑定(bind),所以除了指定键之外的任何键都应该被附加到一个变量中。

请帮忙!

最佳答案

Is there any way using keybindings in java to get the text i type in JTextArea in a string variable??

e.g If i type "Stack overflow" in JtextArea , using keybindings i need to get "stack overflow" in a string variable.

I can able to do it using keyListeners(by keypressed event) how can i achieve it in keybindings?

关于java - JtextArea 中的键绑定(bind)以获取键入的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22908042/

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