Okay.. so what is going on with Windows and CTRL+PLUS ? Scott
On Fri, Sep 26, 2014 at 1:35 PM, Stephen F Northover < steve.x.northo...@oracle.com> wrote: > Two on Windows, one on Mac. See https://javafx-jira.kenai.com/ > browse/RT-38830 > > Steve > > > On 2014-09-26, 1:25 PM, Stephen F Northover wrote: > >> This is on Mac. Will try Windows. >> >> Steve >> >> On 2014-09-26, 1:24 PM, Kevin Rushforth wrote: >> >>> Is this on a Mac or on Windows? I just ran your test case and I get two >>> runnables, which is what I would expect. >>> >>> -- Kevin >>> >>> >>> Stephen F Northover wrote: >>> >>>> I am only seeing the runnable fired once in FX 8u40. >>>> >>>> Steve >>>> >>>> Steps: >>>> >>>> 1) Run TestKeyCombination >>>> 2) Press Control+- >>>> >>>> Here is the test code: >>>> >>>> import javafx.application.Application; >>>> import javafx.scene.Group; >>>> import javafx.scene.Scene; >>>> import javafx.scene.control.Button; >>>> import javafx.scene.input.KeyCharacterCombination; >>>> import javafx.scene.input.KeyCode; >>>> import javafx.scene.input.KeyCodeCombination; >>>> import javafx.scene.input.KeyCombination; >>>> import javafx.stage.Stage; >>>> >>>> public class TestKeyCombination extends Application { >>>> public static void main(String[] args) { >>>> Application.launch(args); >>>> } >>>> >>>> @Override public void start(Stage stage) { >>>> stage.setTitle("Test KeyCombination"); >>>> Scene scene = new Scene(new Group(), 600, 450); >>>> Button button1 = new Button(); >>>> button1.setText("Click Me"); >>>> stage.setScene(scene); >>>> stage.show(); >>>> >>>> KeyCombination cmdMinus = new KeyCodeCombination(KeyCode.MINUS, >>>> KeyCombination.CONTROL_DOWN); >>>> KeyCombination cmdMinusFromCharacter = new >>>> KeyCharacterCombination("-", KeyCombination.CONTROL_DOWN); >>>> Runnable runnable = () -> System.out.println("HI"); >>>> scene.getAccelerators().put(cmdMinus, runnable); >>>> scene.getAccelerators().put(cmdMinusFromCharacter, runnable); >>>> } >>>> } >>>> >>>> >>>> On 2014-09-26, 1:01 PM, Scott Palmer wrote: >>>> >>>>> KeyCombination cmdMinus = new Key*Code*Combination(KeyCode.MINUS, >>>>> KeyCombination.CONTROL_DOWN); >>>>> KeyCombination cmdMinusFromCharacter = new >>>>> Key*Character*Combination("-", >>>>> KeyCombination.CONTROL_DOWN); >>>>> >>>>> Using the above like this: >>>>> scene.getAccelerators().put(cmdMinus, runnable); >>>>> scene.getAccelerators().put(cmdMinusFromCharacter, runnable); >>>>> >>>>> Will result in the runnable being fired twice from the same keypress. >>>>> >>>>> I propose changing the accelerator processing logic so that only one >>>>> runnable gets called as the intention appears to be that a >>>>> KeyCombination >>>>> can only have one runnable associated with it, but the logic in Map >>>>> doesn't >>>>> see the above two KeyCombinations as the same key in the Map. >>>>> >>>>> Note: With the second combination above I really wanted something that >>>>> worked for both MINUS and SUBTRACT simultaneously - since they both >>>>> type >>>>> the same Character and only one accelerator can be set on a MenuItem. >>>>> >>>>> Scott >>>>> >>>> >>>> >> >