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

Incorrect parsing of mnemonic in controls text

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u60
    • Fix Version/s: openjfx17
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64 bit

      A DESCRIPTION OF THE PROBLEM :
      According to javadoc, "_" character in controls text should mark mnemonic, but only when not repeated twice ("__"), in which case it should be treated as single character. But actually result on screen contains double underscores. Logic for this is located in class com.sun.javafx.scene.control.behavior.TextBinding. Looks like it really do some parsing, but probably parsed text is not updated back to control.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run example application.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some buttons, checkboxes and radio buttons should have text "Mnemonic" with "M" underlined, and some with text "No_Mnemonic" withound underlining.
      ACTUAL -
      Actual text on screen is "No__Mnemonic"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.RadioButton;
      import javafx.scene.control.ToggleButton;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class MnemonicTestAppication extends Application
      {
          @Override
          public void start(Stage stage) throws Exception {
              final VBox box = new VBox(5);
              box.getChildren().addAll(
                      new Button("_Mnemonic"),
                      new Button("No__Mnemonic"),
                      new ToggleButton("_Mnemonic"),
                      new ToggleButton("No__Mnemonic"),
                      new RadioButton("_Mnemonic"),
                      new RadioButton("No__Mnemonic"),
                      new CheckBox("_Mnemonic"),
                      new CheckBox("No__Mnemonic"));
              stage.setScene(new Scene(box));
              stage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Some kind of workaround is to call setMnemonicParsing(false) when it is sure what no mnemonic will be present in text.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mstrauss Michael Strauß
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: