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

Opening/Closing Animation of TitledPane in nested Accordions with some Controls not working as expected

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 7u6, 7u15, 8
    • 8
    • javafx

    Description

      Consider the following modified oracle example code for Accordions:


      ===== AccordionTest.java =====

      package test;

      import javafx.application.Application;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.Accordion;
      import javafx.scene.control.TitledPane;
      import javafx.scene.image.Image;
      import javafx.scene.image.ImageView;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;

      public class AccordionTest extends Application {

        final String[] imageNames = new String[]{"Apples", "Flowers", "Leaves"};
        final Image[] images = new Image[imageNames.length];
        final ImageView[] pics = new ImageView[imageNames.length];
        final TitledPane[] tps = new TitledPane[imageNames.length];

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

        @Override public void start(Stage stage) {
          stage.setTitle("TitledPane");
          Scene scene = new Scene(new Group(), 80, 180);
          scene.setFill(Color.GHOSTWHITE);

          final Accordion accordion1 = new Accordion ();

          for (int i = 0; i < imageNames.length; i++) {
            images[i] = new
                    Image(getClass().getResourceAsStream(imageNames[i] + ".jpg"));
            pics[i] = new ImageView(images[i]);
            tps[i] = new TitledPane(imageNames[i],pics[i]);
          }
          accordion1.getPanes().addAll(tps);

          final Accordion accordion2 = new Accordion ();

          for (int i = 0; i < imageNames.length; i++) {
            images[i] = new
                    Image(getClass().getResourceAsStream(imageNames[i] + ".jpg"));
            pics[i] = new ImageView(images[i]);
            tps[i] = new TitledPane(imageNames[i],pics[i]);
          }
          accordion2.getPanes().addAll(tps);

          final Accordion accordion3 = new Accordion ();

          for (int i = 0; i < imageNames.length; i++) {
            images[i] = new
                    Image(getClass().getResourceAsStream(imageNames[i] + ".jpg"));
            pics[i] = new ImageView(images[i]);
            tps[i] = new TitledPane(imageNames[i],pics[i]);
          }
          accordion3.getPanes().addAll(tps);

          final Accordion rootAccordion = new Accordion ();

          TitledPane first = new TitledPane("First", accordion1);
          TitledPane second = new TitledPane("Second", null);
          second.setGraphic(null);
          second.setCollapsible(false);
          TitledPane third = new TitledPane("Third", accordion3);
          rootAccordion.getPanes().add(first);
          rootAccordion.getPanes().add(second);
          rootAccordion.getPanes().add(third);

          Group root = (Group)scene.getRoot();
          root.getChildren().add(rootAccordion);
          stage.setScene(scene);
          stage.show();
        }
      }

      ================

      This contains nested accordions that simulate a tree like structure. When opening/closing the TitledPanes, ugly gaps appear on the animation (between the first nested Accordion and the second TitledPane of the toplevel Accordion):

      http://250kb.de/u/130517/p/yobFmC94fFZV.png

      This also happens with other controls, like the one in this example: https://forums.oracle.com/forums/thread.jspa?threadID=2339215

      Picture:

      http://250kb.de/u/130517/p/eud3gpxND0Uj.png


      This effect gets worse with the level of nested Accordions.

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            srheinnecjfx Sebastian Rheinnecker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: