kooyee ‘s blog

开源软件, 众人努力的结晶, 全人类的共同财富
posts - 103, comments - 55, trackbacks - 0, articles - 66
   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

[Text] 改变文字事件

Posted on 2008-03-01 19:44 kooyee 阅读(459) 评论(0)  编辑  收藏 所属分类: Swing/Applet


void caretPositionChanged(InputMethodEvent event)
          This method is called when the cursor position within the text is changed.
 void inputMethodTextChanged(InputMethodEvent event)
          This method is called when the text is changed.


inputMethodTextChanged 事件在文字改变后触发


The text field fires three events: a key-pressed event, a key-typed event, and a key-released event.
Note :
the key-typed event doesn't have key code information. 含有key charactere信息
key-pressed and key-released events don't have key character information. 含有key code信息

用来检验text changed可以用key-released events. 因为它能够通过getText()得到textfield中改变后的text.  而 key-pressed event, key-typed event 得到的是改变前的文字

只有注册用户登录后才能发表评论。


网站导航: