Adding components (or just nodes) to layouts doesn't wok well. vertical vs. horizontal gets switched. New components don't get centered.
May be related toRT-4522 and it's constellation.
Here's some code to play with. Push the button to see the bug. Swap Flow for VBox and HBox to see more buggy behaviors.
---
I don't see a JavaFX 1.2 in the version list.
---
package growflow;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.layout.Flow;
import javafx.scene.layout.LayoutInfo;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.shape.Polygon;
import javafx.scene.paint.Color;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
def otherShape = Polygon {
points : [ 0,0, 50,0, 50,50 ]
fill: Color.BLUE
}
def otherComponent = Label {
text: "Bigger, not centered"
font: Font {
size:18
}
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
override public function doLayout() {
java.lang.System.out.println("doLayout {boundsInParent}");
super.doLayout();
}
}
def growFlowButton: Button =
Button {
text: "Grow"
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
action: function(){
flowContent = [growFlowButton, otherComponent];
}
}
var flowContent : Node[] = [growFlowButton] on replace {
for(node in flowContent) {
java.lang.System.out.println("on replace {node} {node.boundsInParent}");
}
};
def flow:Flow = Flow {
vertical: true;
nodeHPos: HPos.CENTER;
nodeVPos: VPos.CENTER;
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
content: bind flowContent;
layoutX: bind (scene.width - flow.width) / 2;
layoutY: bind (scene.height - flow.height) / 2;
}
def scene = Scene {
width: 200
height: 200
content: [ flow ]
}
Stage {
title : "GrowFlow"
scene: scene
}
May be related to
Here's some code to play with. Push the button to see the bug. Swap Flow for VBox and HBox to see more buggy behaviors.
---
I don't see a JavaFX 1.2 in the version list.
---
package growflow;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.layout.Flow;
import javafx.scene.layout.LayoutInfo;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.shape.Polygon;
import javafx.scene.paint.Color;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
def otherShape = Polygon {
points : [ 0,0, 50,0, 50,50 ]
fill: Color.BLUE
}
def otherComponent = Label {
text: "Bigger, not centered"
font: Font {
size:18
}
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
override public function doLayout() {
java.lang.System.out.println("doLayout {boundsInParent}");
super.doLayout();
}
}
def growFlowButton: Button =
Button {
text: "Grow"
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
action: function(){
flowContent = [growFlowButton, otherComponent];
}
}
var flowContent : Node[] = [growFlowButton] on replace {
for(node in flowContent) {
java.lang.System.out.println("on replace {node} {node.boundsInParent}");
}
};
def flow:Flow = Flow {
vertical: true;
nodeHPos: HPos.CENTER;
nodeVPos: VPos.CENTER;
layoutInfo: LayoutInfo {
hpos: HPos.CENTER,
vpos: VPos.CENTER
}
content: bind flowContent;
layoutX: bind (scene.width - flow.width) / 2;
layoutY: bind (scene.height - flow.height) / 2;
}
def scene = Scene {
width: 200
height: 200
content: [ flow ]
}
Stage {
title : "GrowFlow"
scene: scene
}