JTextArea问题?

lian2002 2003-08-18 10:35:05
在JTextArea里这样获得,光标所在位置?
...全文
32 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
inflames 2003-08-18
  • 打赏
  • 举报
回复
sorry,baby! haha
shine333 2003-08-18
  • 打赏
  • 举报
回复
多了一个}
shine333 2003-08-18
  • 打赏
  • 举报
回复
不是MouseMotionListener,大哥是光标,不是鼠标

textArea.addCaretPosition(new CaretPosition(){
public void caretUpdate(CaretEvent e){
int caretPosition = e.getDot(); //== textArea.getCaretPosition();
int mark = e.getMark(); //有选择区域时的另一端,可能比getDot大,也可能小
}
}

});
shine333 2003-08-18
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2158/2158491.xml?temp=.2953607
inflames 2003-08-18
  • 打赏
  • 举报
回复
加事件监听器。MouseMotionListener
freejacky 2003-08-18
  • 打赏
  • 举报
回复
什么意思??
你要做什么??
pilgram 2003-08-18
  • 打赏
  • 举报
回复
getCaretPosition
public int getCaretPosition()Returns the position of the text insertion caret for the text component.
Returns:
the position of the text insertion caret for the text component >= 0

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧