And this is how it initially looked like in FX 8.0
FX 8 ScenicView VBox highlighted |
Basically its composed of a VBox in a TitledPane that is displayed in its own undecorated, modal Stage over the main app stage. Here's the code:
Stage passStage = new Stage( StageStyle.UNDECORATED );
passStage.initModality( Modality.WINDOW_MODAL );
passStage.initOwner( primaryStage );
Button okBut = new Button( "OK" );
Button exitBut = new Button( "Cancel" );
TilePane buttonBox = new TilePane(24,0);
buttonBox.setPadding( new Insets(6,0,6,0) );
buttonBox.getChildren().addAll( okBut, exitBut );
buttonBox.setAlignment( Pos.CENTER );
VBox passBox = new VBox();
passBox.setAlignment( Pos.CENTER );
passBox.setPadding( new Insets( 12,24,12,24 ) );
PasswordField passField = new PasswordField();
passBox.getChildren().addAll( new Label( "Enter Your ID" ), passField, buttonBox );
TitledPane loginPane = new TitledPane( "Authentication", passBox );
loginPane.setCollapsible( false );
Scene loginScene = new Scene( loginPane, 200, 110 );
passStage.setScene( loginScene );
passStage.show();
I found that if the Stage style is changed to decorated it displays blank until resized, however if the style is set to utility then the content displays correctly ?
FX 8 Decorated Stage |
FX 8 Utility Stage |
So with all these clues I fiddled around a bit and found that if I rather set the VBox size and leave out the Scene size it works, like so:
passBox.setPrefSize( 200, 110 );
Scene loginScene = new Scene( loginPane, 200, 110);
FX 8.0 Modena |
Finally logged in and started to check out the scene .... see part 3.
No comments:
Post a Comment