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

FlowPane doesn't layout scaled children properly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8
    • Component/s: javafx

      Description

      I have a issue with the flowpane layout in JavaFX(2.2). I'd like to scale the children nodes within it(e.g with a slider). The scaling part works fine but when they are scaled the children starts to clip each other. Which is really not what I want. What I want is to be able to scale them without letting them overlap each other. How do I solve this ?

      Here is an example app that shows this behaviour:

      public class App extends Application
      {
          public static void main( String[] args )
          {
              launch();
              System.out.println( "Hello World!" );
          }

          @Override
          public void start(Stage stage) throws Exception {


              FlowPane flowPane = new FlowPane();

              Slider slider = new Slider(0.1, 2.0, 1.0);
              slider.setMajorTickUnit(0.1);


              flowPane.getChildren().add(slider);



              final Circle circleA = new Circle(20, Color.RED);

              circleA.scaleXProperty().bind(slider.valueProperty());
              circleA.scaleYProperty().bind(slider.valueProperty());

              Circle circleB = new Circle(20, Color.BLACK);
              circleB.scaleXProperty().bind(slider.valueProperty());
              circleB.scaleYProperty().bind(slider.valueProperty());


              flowPane.getChildren().add(circleA);
              flowPane.getChildren().add(circleB);

              Scene scene = SceneBuilder.create().root(flowPane).build();

              stage.setScene(scene);
              stage.setMinHeight(300);
              stage.setMinWidth(300);
              stage.show();
          }
      }

        Attachments

          Activity

            People

            Assignee:
            msladecek Martin Sládeček
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: