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();
}
}
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();
}
}