在Java中更改键盘输入语言

在Java中更改键盘输入语言

本文介绍了在Java中更改键盘输入语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

是否可以使用Java设置/更改键盘输入语言(例如,从英语到德语)?

Is there a way to set/change the keyboard input language in Java (eg from English to German)?

用例示例:用于回放的脚本在德语键盘上记录(键入).自动播放是在英语键盘上完成的...如果在运行脚本之前未将键盘自动设置为德语,则会失败.

Example Use Case: Script to be used for playback is recorded (typed in) on a German keyboard. The automated playback is done on a English keyboard...fails if keyboard is not set to German automatically before script is run.

推荐答案

键盘输入映射完全由我熟悉的每个平台上的操作系统管理. Java没有提供用于以跨平台方式进行操作的API.我将调查您可以通过 JNA 甚至(如果您感到肮脏)可以操作的本机API.掏空调用某些特定于平台的命令来完成您需要的操作.

The keyboard input map is managed entirely by the operating system on every platform that I'm familiar with. Java provides no APIs for manipulating this in a cross-platform manner. I would investigate native APIs that you could manipulate via JNA, or even (if you're feeling dirty) shelling out to call some platform-specific command which does what you need.

您不会在JDK标准库中找到解决方案.

You're not going to find a solution within the JDK standard lib.

这篇关于在Java中更改键盘输入语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 09:54