package javafx_layoutpanes;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
/**
*
* @web http://java-buddy.blogspot.com/
*/
public class JavaFX_LayoutPanes extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com: borderPane");
Group root = new Group();
double width = 400;
double height = 300;
Scene scene = new Scene(root, width, height, Color.WHITE);
BorderPane borderPane = new BorderPane();
borderPane.setPrefSize(width, height);
borderPane.setTop(new Button("Top"));
borderPane.setBottom(new Button("Bottom"));
borderPane.setCenter(new Button("Center"));
borderPane.setLeft(new Button("Left"));
borderPane.setRight(new Button("Right"));
root.getChildren().add(borderPane);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Related: JavaFX 2.0: set width and height of Layout Pane - setPrefSize()
No comments:
Post a Comment