Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pasted values are duplicated in section Properties -> Style #221

Closed
tymur-berezhnoi opened this issue Jan 31, 2019 · 2 comments · Fixed by #427
Closed

Pasted values are duplicated in section Properties -> Style #221

tymur-berezhnoi opened this issue Jan 31, 2019 · 2 comments · Fixed by #427
Assignees
Labels
bug Something isn't working

Comments

@tymur-berezhnoi
Copy link

I'm using:

Product Version
JavaFX Scene Builder 10.0.0

Build Information
Version 10.0.0
Date: 2018-06-05
Java Version: 10.0.1+10, Oracle Corporation
....
....
Operating System
Mac OS X, x86_64, 10.13.6

whenever I copy a value and paste it to the Properties -> Style I see the value is duplicated in one field: #2b4496#2b4496

For example, I want to use color #2b4496 for style -fx-background-color -> I copy the value #2b4496 somewhere and paste it as value in the scene builder and get the value #2b4496#2b4496. It always happens when I use hot keys for copy/paste in my Mac OS Command+C/Command+V, but it works just fine when I use mouse right click -> copy -> paste.

@abhinayagarwal abhinayagarwal added the bug Something isn't working label Feb 1, 2019
@abhinayagarwal abhinayagarwal self-assigned this Feb 1, 2019
@jperedadnr
Copy link
Collaborator

jperedadnr commented Feb 3, 2019

Actually this seems to be a JavaFX bug.

It can be reproduced on Mac, when there is a system MenuBar with a MenuItem that has an accelerator set to Cmd+V, and a TextField.

Given that the TextField also has an internal key event handler based on the same key combination, both events are processed.

To reproduce:

    @Override
    public void start(Stage stage) {
       TextField textField = new TextField();

        MenuItem paste = new MenuItem("Paste");
        paste.setOnAction(e -> textField.paste());
        paste.setAccelerator(new KeyCodeCombination(KeyCode.V, KeyCombination.META_DOWN));
        Menu menu = new Menu("Edit");
        menu.getItems().add(paste);
        MenuBar menuBar = new MenuBar(menu);
        menuBar.setUseSystemMenuBar(true);

        BorderPane pane = new BorderPane(textField);
        pane.setTop(menuBar);

        Scene scene = new Scene(pane, 300, 200);
        stage.setScene(scene);
        stage.show();
    }

now copy something to the clipboard and paste it using Cmd+V, it will be duplicated.

@abhinayagarwal
Copy link
Collaborator

This is a JavaFX bug and has been reported in OpenJFX repository - javafxports/openjdk-jfx#370

Oliver-Loeffler added a commit to Oliver-Loeffler/scenebuilder that referenced this issue Jan 4, 2022
Oliver-Loeffler added a commit to Oliver-Loeffler/scenebuilder that referenced this issue Jan 4, 2022
Oliver-Loeffler added a commit to Oliver-Loeffler/scenebuilder that referenced this issue Jan 9, 2022
jperedadnr pushed a commit that referenced this issue Oct 3, 2022
… and 556. (#427)

* Added workaround for JDK-8205915. Will fix issues #221, #263 and #306.

* The conditional paste is now directly performed inside
DocumentWindowController. The separate class has been removed.

* Removed JUnit dependency.

* Changed TODO from JDK-8205915 to JDK-8280057.

* The workaround can now be toggled within the Preferences dialog.

It is by default active for MacOS.
A tooltip is installed for quick help.
The checkbox is disabled when not running
on MacOS.

* Reverted change in PrefsController.

* Preference is now only displayed on MacOS.

* ToolTip text updated accordingly.

* The alternate paste behavior is now activated by default on macOS.

Co-authored-by: Oliver Löffler <Oliver-Loeffler@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
3 participants