- 1 year ago
Disable Windows Touch Feedback in JavaFx application
Comment
1 / 1
To disable Windows touch feedback in a JavaFX application, you can make use of the WinAPI
library and interact with the Windows API directly. Here's an example of how you can achieve this:
javaimport com.sun.jna.Native;
import com.sun.jna.platform.win32.User32;
public class DisableTouchFeedback {
public static void main(String[] args) {
// Load the User32 library
User32 user32 = User32.INSTANCE;
// Disable touch feedback
boolean success = user32.SetPanningFeedback(user32.GetDesktopWindow(), User32.PanFeedback.PAN_FEEDBACK_OFF);
if (success) {
System.out.println("Touch feedback disabled");
} else {
System.out.println("Failed to disable touch feedback");
}
}
}
Note that you need to include the jna
and jna-platform
libraries in your project's dependencies to use the WinAPI
functions. Make sure to handle any exceptions that may occur during the execution of the code.
Keep in mind that this solution is specific to Windows and relies on platform-specific libraries. It may not work on other operating systems or with different versions of Windows.