滚动窗格包装文本窗格时,如何防止JScrollPane箭头键处理移动插入符号

滚动窗格包装文本窗格时,如何防止JScrollPane箭头键处理移动插入符号,第1张

滚动窗格包装文本窗格时,如何防止JScrollPane箭头键处理移动插入符号

您将需要修改

KeyBindings

试试这个开始

InputMap im = textarea.getInputMap(WHEN_FOCUSED);ActionMap am = textarea.getActionMap();am.get("caret-down").setEnabled(false);am.get("caret-up").setEnabled(false);

现在您已经可以工作了,您需要担心所有这些

selection-up = shift pressed UPcaret-next-word = ctrl pressed RIGHTselection-previous-word = shift ctrl pressed LEFTselection-up = shift pressed KP_UPcaret-down = pressed DOWNcaret-previous-word = ctrl pressed LEFTcaret-end-line = pressed ENDselection-page-up = shift pressed PAGE_UPcaret-up = pressed KP_UPdelete-next = pressed DELETEcaret-begin = ctrl pressed HOMEselection-backward = shift pressed LEFTcaret-end = ctrl pressed ENDdelete-previous = pressed BACK_SPACEselection-next-word = shift ctrl pressed RIGHTcaret-backward = pressed LEFTcaret-backward = pressed KP_LEFTselection-forward = shift pressed KP_RIGHTdelete-previous = ctrl pressed Hunselect = ctrl pressed BACK_SLASHinsert-break = pressed ENTERselection-begin-line = shift pressed HOMEcaret-forward = pressed RIGHTselection-page-left = shift ctrl pressed PAGE_UPselection-down = shift pressed DOWNpage-down = pressed PAGE_DOWNdelete-previous-word = ctrl pressed BACK_SPACEdelete-next-word = ctrl pressed DELETEselection-backward = shift pressed KP_LEFTselection-page-right = shift ctrl pressed PAGE_DOWNcaret-next-word = ctrl pressed KP_RIGHTselection-end-line = shift pressed ENDcaret-previous-word = ctrl pressed KP_LEFTcaret-begin-line = pressed HOMEcaret-down = pressed KP_DOWNselection-forward = shift pressed RIGHTselection-end = shift ctrl pressed ENDselection-previous-word = shift ctrl pressed KP_LEFTselection-down = shift pressed KP_DOWNinsert-tab = pressed TABcaret-up = pressed UPselection-begin = shift ctrl pressed HOMEselection-page-down = shift pressed PAGE_DOWNdelete-previous = shift pressed BACK_SPACEcaret-forward = pressed KP_RIGHTselection-next-word = shift ctrl pressed KP_RIGHTpage-up = pressed PAGE_UP


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5506855.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存