[英]How to change the default caret in a Java application?
我看过一些示例,这些示例更改了单个JTextField的默认插入记号,但是是否有任何函数或代码将整个应用程序的默认插入记号更改为另一个插入记号?
Component.setCursor is the API that you can use to set the cursor/caret of your choice. Component.setCursor是可用于设置所选光标/插入符号的API。 However, you should note the contract of this API.
但是,您应注意此API的合同。
Setting the cursor of a Container causes that cursor to be displayed within all of the container's subcomponents, except for those that have a non-null cursor.
设置容器的光标会导致该光标显示在容器的所有子组件中,除了那些具有非空游标的组件。
So setting the cursor on the top-most container should probably do it unless it is set in child components. 因此,除非将光标设置在子组件中,否则将光标设置在最顶部的容器上应该可以做到。
Note that if you want to create a custom cursor, you would have to use Toolkit.createCustomCursor 请注意,如果要创建自定义光标,则必须使用Toolkit.createCustomCursor
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.