Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8125254

Default button works on Mac runtime, not on Windows, when same button is assigned default & cancel.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.0.2
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      No specifics known for user/developer Windows environment, but reproduced on my Win 7 laptop w/JDK7u7 and JDK7u9.

      Description

      Using DialogFX lib directly or w/i JFXtras, designate same button as default & cancel (example use case: prompting user to delete something, want to default in all cases to "No" button). Calls to setDefaultButton() & setCancelButton() work, code executes fine on Mac (ENTER & ESCAPE both return value for designated button), but not on Windows. Tested on at least two Windows machines with same results.

      Some sample code to setup dialog is:

              List<String> buttonLabels = new ArrayList<>(2);
              buttonLabels.add("Affirmative");
              buttonLabels.add("Negative");
              
              DialogFX dialog = new DialogFX(Type.QUESTION);
              dialog.setTitleText("Question Dialog Box Example");
              dialog.setMessage("This is an example of an QUESTION dialog box, created using DialogFX. This also demonstrates the automatic wrapping of text in DialogFX. Would you like to continue?");
              dialog.addButtons(buttonLabels, 1, 1);
              int i = dialog.showDialog();
              System.out.println("Return code=" + i);

      DialogFX.java attached, also available via GitHub.

        Attachments

          Activity

            People

            Assignee:
            miflemi Mick Fleming (Inactive)
            Reporter:
            mheckler Mark Heckler (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Imported: