-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Description:
We have encountered an issue with the copy functionality specifically on the Windows operating system. Despite successful implementation and functionality on macOS, the copy feature fails to work as expected on Windows.
We have added a right-click copy menu to a Label component in our application. While this functionality works well on macOS, allowing users to copy the entire content, it fails to achieve the same on Windows.
Platform: Windows 11
JavaFX: 22.0.1
JAVA: 21
jpro-routing-core: 0.2.10
jpro-webapi:2023.3.3
Environment: Local javafx client, not running in a web browser.
Below is the code snippet used for adding the copy menu to the Label:
Label testLabel = new Label("Id: 12345");
testLabel.setOnContextMenuRequested(evt -> {
ContextMenu contextMenu = testLabel.getContextMenu();
if (contextMenu == null) {
MenuItem copyItem = new MenuItem("Copy");
contextMenu = new ContextMenu(copyItem);
contextMenu.setOnShown(event -> {
Node node = copyItem.getStyleableNode();
if (node != null) {
CopyUtil.setCopyOnClick(node, "12345");
}
});
testLabel. setContextMenu(contextMenu);
}
contextMenu.show(testLabel, evt.getScreenX(), evt.getScreenY());
});Other demo
Dialog<Void> dialog = new Dialog<>();
dialog.setTitle("Test");
Button copyButton = new Button("Copy Button");
dialog.getDialogPane().setContent(copyButton);
CopyUtil.setCopyOnClick(copyButton, "Copy Button Content"); // Works well
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL);
Node node = dialog.getDialogPane().lookupButton(ButtonType.APPLY);
CopyUtil.setCopyOnClick(node, "Copy Apply Button Content"); // not working !~
dialog.show();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels