Advertisement
Giorgos_Xou

App.java

Oct 30th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.78 KB | None | 0 0
  1. package app;
  2.  
  3. import javafx.application.Application;
  4. import javafx.fxml.FXML;
  5. import javafx.fxml.FXMLLoader;
  6. import javafx.scene.CacheHint;
  7. import javafx.scene.Group;
  8. import javafx.scene.Parent;
  9. import javafx.scene.Scene;
  10. import javafx.scene.SceneAntialiasing;
  11. import javafx.scene.SubScene;
  12. import javafx.scene.control.Button;
  13. import javafx.scene.control.Tab;
  14. import javafx.scene.control.TabPane;
  15. import javafx.scene.layout.BorderPane;
  16. import javafx.scene.paint.Color;
  17. import javafx.stage.Stage;
  18. import javafx.stage.StageStyle;
  19.  
  20. public class App extends Application {
  21.     @FXML
  22.    
  23.     public Parent root;
  24.     public TabPane TabPane1;
  25.     public BorderPane BorderPane1;
  26.    
  27.     public static void main(String[] args) throws Exception {
  28.         launch(args);
  29.     }
  30.  
  31.     @Override
  32.     public void start(Stage primaryStage) throws Exception {
  33.  
  34.         FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
  35.         loader.setController(this);
  36.  
  37.         root = loader.load();
  38.         Scene RootScene = new Scene(root, 1120, 540);
  39.  
  40.         primaryStage.setScene(RootScene);
  41.  
  42.         Thread t = new Thread() {
  43.             public void run() {
  44.  
  45.                 //Setting NewButton2
  46.                 Button NewButton2 = new Button();
  47.  
  48.                 NewButton2.setId("Button2");
  49.                 NewButton2.setText("test2");
  50.                 NewButton2.setPrefWidth(150);
  51.                 NewButton2.setPrefHeight(50);
  52.                 NewButton2.setTranslateX(-75);
  53.                 NewButton2.setTranslateY(-25);
  54.                 NewButton2.setTranslateZ(900);
  55.  
  56.                 // Setting group
  57.                 Group SubRootGroup = new Group(NewButton2);
  58.  
  59.                 SubRootGroup.setTranslateX(0);
  60.                 SubRootGroup.setTranslateY(0);
  61.                 SubRootGroup.setTranslateZ(0);
  62.  
  63.                 // Setting Scene
  64.                 SubScene SubScene1 = new SubScene(SubRootGroup, 0, 0, true, SceneAntialiasing.BALANCED);
  65.  
  66.                 SubScene1.setId("SubScene1");
  67.                 SubScene1.setFill(Color.WHITE);
  68.                 SubScene1.heightProperty().bind(RootScene.heightProperty());
  69.                 SubScene1.widthProperty().bind(RootScene.widthProperty());
  70.  
  71.                 // Initializing Camera
  72.                 SimpleFPSCamera SimpleFPSCam = new SimpleFPSCamera();
  73.                
  74.                 // Setting Camera To The Scene
  75.                 SubScene1.setCamera(SimpleFPSCam.getCamera());
  76.  
  77.                 // Adding Scene To Stage-TabPane.Tab(0)
  78.                 TabPane1.getTabs().add(new Tab("Without Shadows"));
  79.                 TabPane1.getTabs().get(0).setContent(SubScene1);
  80.  
  81.                 // Loading Mouse & Keyboard Events
  82.                 SimpleFPSCam.loadControlsForSubScene(SubScene1);
  83.             }
  84.         };
  85.         t.setDaemon(true);
  86.         t.run();
  87.  
  88.         primaryStage.show();
  89.  
  90.     }
  91. }
  92.  
  93.  
  94.                 /*
  95.                 SubScene1.setCache(true);
  96.                 SubScene1.setCacheHint(CacheHint.SPEED);
  97.  
  98.                 BorderPane1.setCache(true);
  99.                 BorderPane1.setCacheShape(true);
  100.                 BorderPane1.setCacheHint(CacheHint.SPEED);
  101.  
  102.                 NewButton2.setCache(true);
  103.                 NewButton2.setCacheShape(true);
  104.                 NewButton2.setCacheHint(CacheHint.SPEED);
  105.  
  106.                 SubRootGroup.setCache(true);
  107.                 SubRootGroup.setCacheHint(CacheHint.SPEED);
  108.  
  109.                 root.setCache(true);
  110.                 root.setCacheHint(CacheHint.SPEED);
  111.  
  112.                 TabPane1.setCache(true);
  113.                 TabPane1.setCacheShape(true);
  114.                 TabPane1.setCacheHint(CacheHint.SPEED);
  115.  
  116.                 ...
  117.  
  118.                 SimpleFPSCam.setCache(true);
  119.                 SimpleFPSCam.setCacheHint(CacheHint.SPEED);
  120.                 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement