Advertisement
apl-mhd

SomethingCenterInJavFx

Dec 13th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. package sample;
  2.  
  3. import com.sun.prism.paint.Color;
  4. import javafx.application.Application;
  5. import javafx.fxml.FXMLLoader;
  6. import javafx.geometry.Pos;
  7. import javafx.scene.Group;
  8. import javafx.scene.Parent;
  9. import javafx.scene.Scene;
  10. import javafx.scene.layout.BorderPane;
  11. import javafx.scene.layout.GridPane;
  12. import javafx.scene.layout.HBox;
  13. import javafx.scene.layout.VBox;
  14. import javafx.stage.Stage;
  15. import javafx.scene.Scene;
  16. import javafx.scene.control.TextField;
  17. import java.awt.*;
  18. import javafx.scene.control.Button;
  19. import javafx.scene.control.Label;
  20. public class Main extends Application {
  21.  
  22.     @Override
  23.     public void start(Stage primaryStage) throws Exception{
  24.  
  25.         BorderPane root = new BorderPane();
  26.  
  27.         HBox v = new HBox();
  28.         HBox v2 = new HBox();
  29.  
  30.  
  31.         Label label = new Label("name");
  32.  
  33.         v.getChildren().add(label);
  34.  
  35.         v.setAlignment(Pos.CENTER);
  36.         root.setCenter(v);
  37.  
  38.  
  39.  
  40.         Scene ob = new Scene(root,300,400);
  41.  
  42.         primaryStage.setScene(ob);
  43.         primaryStage.show();
  44.  
  45.     }
  46.  
  47.  
  48.     public static void main(String[] args) {
  49.         launch(args);
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement