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

TextBinding problem with mnemonics - StringIndexOutOfBoundsException

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Microsoft Windows 10
      EclipseTemurinOpenJDK 17.0.4

      A DESCRIPTION OF THE PROBLEM :
      Using for example tab pane with tabs which names are long and contains underscores between each word
      ("And_again_yet_another_one_very_long_tab_name_for_test_purposes_to_test_yet_another_string"), when there is multiple tabs and drop down arrow is being clicked the error occurs.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create TabPane.
      2. Add multiple Tabs to TabPane with long names and underscores (e.g. "And_again_yet_another_one_very_long_tab_name_for_test_purposes_to_test_yet_another_string")
      ALTERNATIVELY add at least two Tabs and shrink window until drop down arrow appears
      3. There must be visible drop down arrow.
      4. When drop down arrow is being clicked - the error should occur

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In described scenario there should be no error.
      After drop down arrow being clicked there should be drop down list with all available Tabs to choose from.
      ACTUAL -
      In described scenario error occurs making it impossible to choose Tab from list.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;


      public class SIOFBTest {

          public static void main(String[] args) {
              Application.launch(TabsTest.class, args);
          }

          public static class TabsTest extends Application {

              @Override
              public void start(final Stage mainStage) {
                  TextField textField = new TextField("Field with text");
                  final Tab mainTab = new Tab("Main Tab", textField);
                  final Tab firstTab = new Tab("And_again_yet_another_one_very_long_tab_name_for_test_purposes_to_test string", textField);
                  final Tab secondTab = new Tab("And_again_yet_another_one_very_long_tab_name_for_test_purposes_to_test_yet_another string", textField);

                  final TabPane tabPane = new TabPane(mainTab, firstTab, secondTab);
                  final BorderPane borderPane = new BorderPane();
                  borderPane.setTop(tabPane);
                  Scene scene = new Scene(borderPane, 400, 300);
                  mainStage.setScene(scene);
                  mainStage.show();
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: