Hi,
I am trying to center a text in a label, but when I am setting alignment to Pos.CENTER or set for label -fx-alignment: CENTER in css - the label is still on the left side.
In javafx 1.3 there was a layoutInfo property, but in 2.0 there is no such property. Any ideas?
Btw, here is my code (in groovy):
class FxApp extends Application {
/**
* @param args the command line arguments
*/
static void main(String[] args) {
Application.launch(FxApp.class, args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World");
Region root = new Region();
def scene = new Scene(root, 300, 250, Color.rgb(242, 242, 242));
Label lbl = new Label(
text: "Test",
alignment: Pos.CENTER,
height: 250,
width: 300
)
root.getChildren().add(lbl)
primaryStage.setScene(scene);
primaryStage.setVisible(true);
}
}
ndrw