Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文本框和一个带有其他组件的摆动形式的按钮。我的文本框注册了焦点监听器,按钮注册了动作监听器。
如果我更改文本框中的文本并且没有失去焦点,单击按钮,我的焦点侦听器将被执行并且按钮的动作侦听器永远不会执行。
在文本框上的焦点监听器完成其部分之后,有没有办法强制(以编程方式)调用按钮上的动作监听器?
试着打电话yourButton.doClick();?
yourButton.doClick();