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

Accordion control doesn't size to scene correctly

    Details

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

      Windows 7, b38.

      Description

      I am having problems with Accordion sizing. I took the code below from RT-14168, and changed the manual sizing of the stage in that bug, to a sizeToScene() call. When you do this the Accordion doesn't show correctly. I am having other problems with Accordions inside SplitPanes, but hopefully a fix to the problem below will fix those too.

      import javafx.application.Application;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.Accordion;
      import javafx.scene.control.Label;
      import javafx.scene.control.TitledPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class Main1 extends Application
      {

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

        private Parent getContent()
        {
          VBox list = new VBox(10);

          TitledPane pane1 = new TitledPane();
          pane1.setTitle(new Label("title 1\nLong text long text"));
          pane1.setContent(new Rectangle(100, 40, Color.SKYBLUE));
          TitledPane pane2 = new TitledPane();
          pane2.setTitle(new Label("title 2\nLong text long text"));
          pane2.setContent(new Rectangle(100, 40, Color.BLUEVIOLET));
          Accordion acc = new Accordion();
          acc.getPanes().addAll(pane1, pane2);
          acc.setExpandedPane(pane2);
          list.getChildren().add(acc);
          return list;
        }

        public void start(Stage stage)
        {
          stage.setX(100);
          stage.setY(100);
          Scene scene = new Scene(getContent());
          stage.setScene(scene);
          stage.sizeToScene();
          stage.setVisible(true);
        }
      }

        Attachments

        1. shot1.PNG
          shot1.PNG
          9 kB
        2. shot2.PNG
          shot2.PNG
          14 kB
        3. shot3.PNG
          shot3.PNG
          6 kB

          Activity

            People

            • Assignee:
              raginip Ragini Prasad (Inactive)
              Reporter:
              gmatthewsjfx Graham Matthews (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:
                Imported: