我见过更改单个 JTextField 的默认插入符的示例,但是是否有任何函数或代码可以将整个应用程序的默认插入符更改为另一个插入符?
最佳答案
Component.setCursor是可用于设置您选择的光标/插入符的 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.
因此,将光标设置在最顶层的容器上可能应该可以做到这一点,除非它是在子组件中设置的。
请注意,如果您想创建自定义光标,则必须使用 Toolkit.createCustomCursor
希望这有帮助。
关于java - 如何更改 Java 应用程序中的默认插入符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47808496/