Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package app;
- import javafx.application.Application;
- import javafx.fxml.FXML;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.CacheHint;
- import javafx.scene.Group;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.scene.SceneAntialiasing;
- import javafx.scene.SubScene;
- import javafx.scene.control.Button;
- import javafx.scene.control.Tab;
- import javafx.scene.control.TabPane;
- import javafx.scene.layout.BorderPane;
- import javafx.scene.paint.Color;
- import javafx.stage.Stage;
- import javafx.stage.StageStyle;
- public class App extends Application {
- @FXML
- public Parent root;
- public TabPane TabPane1;
- public BorderPane BorderPane1;
- public static void main(String[] args) throws Exception {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) throws Exception {
- FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
- loader.setController(this);
- root = loader.load();
- Scene RootScene = new Scene(root, 1120, 540);
- primaryStage.setScene(RootScene);
- Thread t = new Thread() {
- public void run() {
- //Setting NewButton2
- Button NewButton2 = new Button();
- NewButton2.setId("Button2");
- NewButton2.setText("test2");
- NewButton2.setPrefWidth(150);
- NewButton2.setPrefHeight(50);
- NewButton2.setTranslateX(-75);
- NewButton2.setTranslateY(-25);
- NewButton2.setTranslateZ(900);
- // Setting group
- Group SubRootGroup = new Group(NewButton2);
- SubRootGroup.setTranslateX(0);
- SubRootGroup.setTranslateY(0);
- SubRootGroup.setTranslateZ(0);
- // Setting Scene
- SubScene SubScene1 = new SubScene(SubRootGroup, 0, 0, true, SceneAntialiasing.BALANCED);
- SubScene1.setId("SubScene1");
- SubScene1.setFill(Color.WHITE);
- SubScene1.heightProperty().bind(RootScene.heightProperty());
- SubScene1.widthProperty().bind(RootScene.widthProperty());
- // Initializing Camera
- SimpleFPSCamera SimpleFPSCam = new SimpleFPSCamera();
- // Setting Camera To The Scene
- SubScene1.setCamera(SimpleFPSCam.getCamera());
- // Adding Scene To Stage-TabPane.Tab(0)
- TabPane1.getTabs().add(new Tab("Without Shadows"));
- TabPane1.getTabs().get(0).setContent(SubScene1);
- // Loading Mouse & Keyboard Events
- SimpleFPSCam.loadControlsForSubScene(SubScene1);
- }
- };
- t.setDaemon(true);
- t.run();
- primaryStage.show();
- }
- }
- /*
- SubScene1.setCache(true);
- SubScene1.setCacheHint(CacheHint.SPEED);
- BorderPane1.setCache(true);
- BorderPane1.setCacheShape(true);
- BorderPane1.setCacheHint(CacheHint.SPEED);
- NewButton2.setCache(true);
- NewButton2.setCacheShape(true);
- NewButton2.setCacheHint(CacheHint.SPEED);
- SubRootGroup.setCache(true);
- SubRootGroup.setCacheHint(CacheHint.SPEED);
- root.setCache(true);
- root.setCacheHint(CacheHint.SPEED);
- TabPane1.setCache(true);
- TabPane1.setCacheShape(true);
- TabPane1.setCacheHint(CacheHint.SPEED);
- ...
- SimpleFPSCam.setCache(true);
- SimpleFPSCam.setCacheHint(CacheHint.SPEED);
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement