Java Code Examples for javafx.scene.Scene

The following are top voted examples for showing how to use javafx.scene.Scene. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: alchem   File: AlertBox.java   Source Code and License 8 votes vote down vote up
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) {
    try {
        Parent root = (Parent) fxmlLoader.load();
        Scene scene = new Scene(root);
        Label alertText = (Label) scene.lookup("#alert_text");
        alertText.setText(msg);
        if (alertType == true)
            alertText.setStyle("-fx-text-fill: chartreuse");
        else
            alertText.setStyle("-fx-text-fill: red");
        Stage stage = new Stage();
        stage.setResizable(false);
        stage.initModality(Modality.WINDOW_MODAL);
        stage.initOwner(primaryStage);
        stage.initStyle(StageStyle.UNDECORATED);
        stage.setScene(scene);
        stage.showAndWait();
    } catch (Exception e) {
    }
}
 
Example 2
Project: spring2017java   File: AnimationDemoSection3.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
    
    Scene scene = new Scene(root);
    
    stage.setScene(scene);
    stage.show();
}
 
Example 3
Project: strongbox   File: StrongboxGUI.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    GroupsView groupsView = new GroupsView(stage, (DefaultSecretsGroupManager) Singleton.secretsGroupManager, Singleton.region);

    Scene scene  = new Scene(borderPane,1100,500);
    scene.getStylesheets().add("style.css");
    stage.setScene(scene);

    borderPane.getChildren().addAll(groupsView);

    stage.show();
}
 
Example 4
Project: gemoc-studio-modeldebugging   File: EventManagerViewPart.java   Source Code and License 7 votes vote down vote up
public void createPartControl(Composite parent) {
	fxCanvas = new FXCanvas(parent, SWT.NONE);
	eventManagerRenderer = new EventManagerRenderer();
	Scene scene = new Scene(eventManagerRenderer);
	fxCanvas.setScene(scene);

	parent.getShell().addListener(SWT.Resize, (e) -> {

	});
}
 
Example 5
Project: GazePlay   File: Stats.java   Source Code and License 7 votes vote down vote up
public Stats(Scene gameContextScene) {
    this.gameContextScene = gameContextScene;

    nbGoals = 0;
    beginTime = 0;
    length = 0;
    zeroTime = System.currentTimeMillis();
    lengthBetweenGoals = new ArrayList<Integer>(1000);

    log.info("GazeUtils ON : " + GazeUtils.isOn());

    if (GazeUtils.isOn()) {
        recordGazeMovements = buildRecordGazeMovements();
        GazeUtils.addStats(this);
    } else {
        recordMouseMovements = buildRecordMouseMovements();
        gameContextScene.addEventFilter(MouseEvent.ANY, recordMouseMovements);
    }

    int heatMapWidth = (int) (gameContextScene.getHeight() / heatMapPixelSize);
    int heatMapHeight = (int) (gameContextScene.getWidth() / heatMapPixelSize);
    log.info("heatMapWidth = {}, heatMapHeight = {}", heatMapWidth, heatMapHeight);
    heatMap = new double[heatMapWidth][heatMapHeight];
}
 
Example 6
Project: MakeSourceList4j   File: Main.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/main.fxml"));
    Parent root = fxmlLoader.load();
    primaryStage.setTitle("ソースリスト作るよ");
    primaryStage.setScene(new Scene(root, 700, 500));
    primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icons.png")));
    primaryStage.setMinHeight(500);
    primaryStage.setMinWidth(700);
    Controller controller = fxmlLoader.getController();
    controller.init(primaryStage);
    primaryStage.setMaxHeight(500);
    primaryStage.setMaxWidth(700);


    primaryStage.show();
}
 
Example 7
Project: radialchart   File: Demo.java   Source Code and License 7 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(graph);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(40, 40, 40), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Radial Chart");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 8
Project: AquamarineLake   File: App.java   Source Code and License 7 votes vote down vote up
public void start(Stage stg) throws IOException {
    guiroot = loader.load();
    sc = new Scene(guiroot);

    contr = loader.getController();

    stg.setScene(sc);
    stg.sizeToScene();
    stg.setTitle("Plasmoxy - SentientLight/TrackMate");
    stg.setMinHeight(stg.getHeight());
    stg.setMinWidth(stg.getWidth());
    stg.show();

    stg.setOnCloseRequest(event ->
    {
        System.out.println("CLOSING");
        contr.close();
    });

    contr.init();

}
 
Example 9
Project: CyberTigerScoreboard   File: CPscorereport.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage mainWin) throws IOException {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    DEFAULT_HEIGHT = screenSize.height - 100;
    DEFAULT_WIDTH = screenSize.width - 100;

    teamTabs = new TabPane(); // Initialize the pane with for the tabs
    setUpHelp = new GUIHelper(this); // Initialize the GUI helper class
    info = setUpHelp.createTextBox("Server not configured!"); // Initialize the textbox
    menuBar = setUpHelp.getMenu(info); // Initialize the menubar and the menus
    elementSect = new StackPane(); // Initialize the element stackpane
    elementSect.getChildren().add(teamTabs); // Add the tabs from teamtabs there
    borderPane = new BorderPane(); // Add the border pane
    borderPane.setTop(menuBar); // Add stuff to the borders
    borderPane.setCenter(elementSect); // But the elementSect in the middle
    borderPane.setBottom(info); // Put the textpane in the bottom
    Scene scene = new Scene(borderPane, DEFAULT_WIDTH, DEFAULT_HEIGHT); // Create the scene for the height
    mainWin.getIcons().add(new Image(ICON_LOC)); // Set the icon as the CyberTiger icon
    mainWin.setTitle("CyberTiger Scoreboard"); // Get the window name
    mainWin.setScene(scene); // Set the window
    mainWin.show(); // Show the window

    refreshData(); // Refresh the data since this creates the rest of teh GUI

    Timeline scoreboardRefresh = new Timeline(new KeyFrame(Duration.seconds(REFRESH_TIMEOUT), (ActionEvent event) -> {
        try {
            refreshData(); // Put the refresh method in this method to autorefresh every minute
        } catch (IOException ex) { // Catch the exception from the database conn
            info.setText("Error refreshing scores! " + ex); // Show the errors
        }
    }));
    scoreboardRefresh.setCycleCount(Timeline.INDEFINITE); // Set the number of times to run
    scoreboardRefresh.play(); // Run the timer
}
 
Example 10
Project: Money-Manager   File: GoToOperation.java   Source Code and License 7 votes vote down vote up
public void goToTransactionHistory(double positionX, double positionY) {
	try {
		Stage TransactionHistoryStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/TransactionHistory.fxml"));
		Scene scene = new Scene(root,800,550);
		TransactionHistoryStage.setScene(scene);
		TransactionHistoryStage.setResizable(false);
		TransactionHistoryStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
		TransactionHistoryStage.setTitle("Transaction History");
		TransactionHistoryStage.setX(positionX);
		TransactionHistoryStage.setY(positionY);
		TransactionHistoryStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 11
Project: Notebook   File: App.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	try {
		Scene scene = new Scene(new LoginView().getView());
		scene.getStylesheets().add("css/application.css");

		primaryStage.setTitle(Constants.APP_NAME);
		primaryStage.setResizable(false);
		primaryStage.setScene(scene);
		primaryStage.getIcons().add(Constants.APP_LOGO);
		primaryStage.show();

		createShortcut();

	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 12
Project: javafx-3d-surface-chart   File: Mesh3DChartPanel.java   Source Code and License 7 votes vote down vote up
public void makeZoomable(Scene scene4EventFilter, Node control4Scaling) {
    scene4EventFilter.addEventFilter(ScrollEvent.ANY, (ScrollEvent event) -> {
        double delta = 1.2;
        double scale = control4Scaling.getScaleX();

        if (ObjectUtils.smallerDoublePrecision(event.getDeltaY(), 0)) {
            scale /= delta;
        } else {
            scale *= delta;
        }

        if (scale < MIN_SCALE || scale > MAX_SCALE) {
            scale = scale < MIN_SCALE ? MIN_SCALE : MAX_SCALE;
        }

        control4Scaling.setScaleX(scale);
        control4Scaling.setScaleY(scale);

        event.consume();
    });
}
 
Example 13
Project: marathonv5   File: HTMLEditorSample.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage stage) {
    stage.setTitle("HTMLEditor Sample");
    stage.setWidth(650);
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();     
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);
 
    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
           
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    
 
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setStyle("-fx-background-color: white");
    scrollPane.setContent(browser);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);
 
    Button showHTMLButton = new Button("Load Content in Browser");
    root.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction((ActionEvent arg0) -> {
        webEngine.loadContent(htmlEditor.getHtmlText());
    });
    
    root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
    scene.setRoot(root);
 
    stage.setScene(scene);
    stage.show();
}
 
Example 14
Project: Orsum-occulendi   File: Main.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	try {
		GridPane root = (GridPane)FXMLLoader.load(getClass().getClassLoader().getResource("mainMenu.fxml"));
		Scene scene = new Scene(root,400,400);
		//scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
		primaryStage.setTitle("Vier Gewinnt: Hauptmenu");
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		primaryStage.setOnCloseRequest(event -> {
			closeAppl();
		});
		primaryStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 15
Project: ChessBot   File: ChessBotAppSplash.java   Source Code and License 7 votes vote down vote up
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
    progressText.textProperty().bind(task.messageProperty());
    loadProgress.progressProperty().bind(task.progressProperty());
    task.stateProperty().addListener((observableValue, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            loadProgress.progressProperty().unbind();
            loadProgress.setProgress(1);
            initStage.toFront();
            FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
            fadeSplash.setFromValue(1.0);
            fadeSplash.setToValue(0.0);
            fadeSplash.setOnFinished(actionEvent -> initStage.hide());
            fadeSplash.play();

            initCompletionHandler.complete();
        }
    });

    Scene splashScene = new Scene(splashLayout);
    initStage.initStyle(StageStyle.UNDECORATED);
    final Rectangle2D bounds = Screen.getPrimary().getBounds();
    initStage.setScene(splashScene);
    initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
    initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
    initStage.show();
}
 
Example 16
Project: erp-frontend   File: StageFactory.java   Source Code and License 7 votes vote down vote up
public static Stage createStage (String title, int width, int height, String fxmlPath) throws IOException {
    //create new stage
    Stage stage = new Stage();

    //set title
    stage.setTitle(title);

    //set width & height
    stage.setWidth(width);
    stage.setHeight(height);

    // load fxml
    Pane pane = FXMLLoader.load(new File(fxmlPath).toURI().toURL());

    //add scene
    Scene scene = new Scene(pane);

    //set scene
    stage.setScene(scene);

    //show window
    stage.show();

    return stage;
}
 
Example 17
Project: CDN-FX-2.2   File: CDNFXController.java   Source Code and License 6 votes vote down vote up
@FXML
protected void menuClickedSettings() {
    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/gui/Settings.fxml"));
        Parent root1 = (Parent) fxmlLoader.load();
        Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.initStyle(StageStyle.UTILITY);
        stage.setTitle("Settings");
        stage.setScene(new Scene(root1));
        stage.setResizable(false);
        stage.show();

        SettingsController settingsController = fxmlLoader.getController();
        settingsController.setCdnfxController(cdnfxController);
    }catch (Exception e){
        StringWriter errors = new StringWriter();
        e.printStackTrace(new PrintWriter(errors));
        DebugLogger.log(errors.toString(), Level.SEVERE);
    }
}
 
Example 18
Project: can4eve   File: ClockControl.java   Source Code and License 6 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(clock1, clock2);
    pane.setSpacing(20);

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Clock Control");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 19
Project: WholesomeChat   File: MainController.java   Source Code and License 6 votes vote down vote up
@FXML
public void onListClick(MouseEvent event) {
	Scene scene = stage.getScene();
	ListView<String> list = (ListView<String>) scene.lookup("#list");
   	if (list.getSelectionModel() != null && list.getSelectionModel().getSelectedItem() != null) {
        JsonObject str = new JsonObject();
        str.addProperty("text", list.getSelectionModel().getSelectedItem().replaceAll("\\[.*?\\] @.*? > ", "").replaceAll("\"", "\\\"").trim());
        str.addProperty("intent", "precheck");
        chatAccess.send(gson.toJson(str));
   	}
}
 
Example 20
Project: Calculadora-JavaFx   File: Calculadora.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage primaryStage) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("view.fxml"));
    
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
 
Example 21
Project: file-transfer   File: HtmlPage.java   Source Code and License 6 votes vote down vote up
public HtmlPage(String link) {
    VBox root = new VBox();
    Scene scene = new Scene(root);
    setTitle("FileSend - Page");
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    try {
        httpsLoad(webEngine, link);
    } catch (NoSuchAlgorithmException | KeyManagementException e) {
        e.printStackTrace();
    }
    root.getChildren().add(browser);
    VBox.setVgrow(browser, Priority.ALWAYS);
    getIcons().add(new Image(getClass().getResourceAsStream(".." + File.separator + "images" + File.separator + "logo.png")));
    setScene(scene);
    setMaximized(true);
}
 
Example 22
Project: FYS_T3   File: statisticsController.java   Source Code and License 6 votes vote down vote up
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
 
Example 23
Project: FYS_T3   File: homepageController.java   Source Code and License 6 votes vote down vote up
@FXML
public void openSeachLugAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/SearchLug.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
Example 24
Project: Projeto-IP2   File: SubmenuAjustes.java   Source Code and License 6 votes vote down vote up
public void start(Stage primaryStage) throws Exception {
	menu = primaryStage;
	
	menu.setTitle("Menu Disciplina");
	
	pane = FXMLLoader.load(this.getClass().getResource("menuAjustesFXML.fxml"));
	
	//pane = (BorderPane) loader.load();
	//Pane telaCadastroDisciplinas = c.getPane();
	/*
	telaCadastroDisciplinas.setPrefHeight(540);
	telaCadastroDisciplinas.setPrefWidth(600);
	
	// primeira tela do menu at� agora � a do cadastro de Disciplinas. Ir� ser mudado.
	pane.setCenter(telaCadastroDisciplinas);			
	menu.sizeToScene();
	menu.setScene(new Scene(pane));
	menu.setResizable(false);
	*/
	//trocarCena(telaCadastroDisciplinas);
	menu.setScene(new Scene(borderpane));
	menu.setResizable(false);
	menu.show();
}
 
Example 25
Project: grpc-samples-java   File: ChatClient.java   Source Code and License 6 votes vote down vote up
private void setupAndShowPrimaryStage(Stage primaryStage) {
    messagesView.setItems(messages);

    send.setText("Send");

    BorderPane pane = new BorderPane();
    pane.setLeft(name);
    pane.setCenter(message);
    pane.setRight(send);

    BorderPane root = new BorderPane();
    root.setCenter(messagesView);
    root.setBottom(pane);

    primaryStage.setTitle("gRPC Chat");
    primaryStage.setScene(new Scene(root, 480, 320));

    primaryStage.show();
}
 
Example 26
Project: FYS_T3   File: homepageController.java   Source Code and License 6 votes vote down vote up
@FXML
public void openStatisticsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Statistics.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
Example 27
Project: WholesomeChat   File: App.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
	
	//UI setup
	
   	//intial login page
	
   	FXMLLoader loginPage = new FXMLLoader(getClass().getResource("/edu/cpp/WholesomeChat/fxml/login.fxml"));
   	Parent loginRoot = loginPage.load();
   	Scene loginScene = new Scene(loginRoot);
   	
   	LoginController loginController = loginPage.getController();
   	loginController.setHostServices(getHostServices());
   	loginController.passStage(stage);
   	
   	
   	//Initialize Stage Displays
   	stage.setResizable(false);
   	stage.setTitle("WholesomeChat Client");
   	stage.getIcons().add(new Image("/edu/cpp/WholesomeChat/resources/icon.png"));
   	stage.setScene(loginScene);
   	stage.show();
   	
}
 
Example 28
Project: Money-Manager   File: GoToRegistration.java   Source Code and License 6 votes vote down vote up
public void goToReRegistration(double positionX, double positionY) {
	try {
		Stage RegistrationIssueStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/RegistrationIssue.fxml"));
		Scene scene = new Scene(root,800,550);
		RegistrationIssueStage.setScene(scene);
		RegistrationIssueStage.setResizable(false);
		RegistrationIssueStage.setTitle("Registration Issue");
		RegistrationIssueStage.setX(positionX);
		RegistrationIssueStage.setY(positionY);
		RegistrationIssueStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
Example 29
Project: Coconut-IDE   File: RenameFilePlace.java   Source Code and License 6 votes vote down vote up
public void start() {
    stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setTitle("Rename File");
    stage.setWidth(400);
    stage.setHeight(150);
    stage.setResizable(false);

    Screen screen = new Screen();
    Point point = screen.calculateCenter(400, 150);
    stage.setX(point.getX());
    stage.setY(point.getY());

    CustomIcons customIcons = new CustomIcons();
    stage.getIcons().add(customIcons.getLogo());

    RenameFileView renameFileView = new RenameFileView();
    Scene scene = new Scene(renameFileView.getView());
    stage.setScene(scene);
    stage.show();
}
 
Example 30
Project: Himalaya-JavaFX   File: MainFXMLController.java   Source Code and License 6 votes vote down vote up
@Override
public void initScreen() {

    playG.refillVillages();

    displayElementsMap();
    displayPlayersInformations();

    try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("InitFXML.fxml"));
        Parent root1 = (Parent) fxmlLoader.load();
        InitFXMLController initCtrl = (InitFXMLController) (fxmlLoader.getController());
        initCtrl.lauch(playG.getBoard());
        Stage stage = new Stage();
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.setTitle("Choix du placement");
        stage.setScene(new Scene(root1));
        stage.showAndWait();
    } catch (IOException ex) {
        Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex);
    }

    displayElementsMap();

}
 
Example 31
Project: Goliath-Overclocking-Utility-FX   File: GoliathOUFX.java   Source Code and License 6 votes vote down vote up
@Override
public void start(Stage stage)
{
    scene = new Scene(new AppFrame(stage));
    scene.getStylesheets().add("skins/Goliath-Magma.css");

    stage.setScene(scene);
    stage.setTitle("Goliath Overclocking Utility V1.0 Alpha");
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setResizable(false);
    stage.setHeight(368);
    stage.setWidth(750);
    stage.show();
}
 
Example 32
Project: hygene   File: Hygene.java   Source Code and License 6 votes vote down vote up
@Override
public void start(final Stage primaryStage) throws IOException, UIInitialisationException, SQLException {
    context.init();

    this.primaryStage = primaryStage;
    setInstance(this);

    final URL resource = getClass().getResource(APPLICATION_VIEW);
    fxmlLoader.setLocation(resource);
    final Parent parent = fxmlLoader.load();

    primaryStage.setTitle(TITLE);
    primaryStage.setMaximized(true);


    primaryStage.setOnCloseRequest(e -> {
        bookmarkStore.writeBookmarksToFile();
        Platform.exit();
    });

    final Scene rootScene = new Scene(parent);
    primaryStage.setScene(rootScene);

    final Image hygeneIcon = new Image(String.valueOf(getClass().getResource(APPLICATION_ICON)));
    primaryStage.getIcons().add(hygeneIcon);

    primaryStage.show();

    parseArguments();

    LOGGER.info("Launching Hygene GUI");
}
 
Example 33
Project: IO   File: BaseController.java   Source Code and License 6 votes vote down vote up
private static void makeLocationScale(Scene scene, Node node) {
    double nodeX = node.getLayoutX();
    double sceneWidth = scene.getWidth();
    double nodeY = node.getLayoutY();
    double sceneHeight = scene.getHeight();
    if (nodeX != 0.0) {
        ChangeListener<Number> xResizer = (arg0, oldValue, newValue) -> node.relocate(nodeX / sceneWidth * newValue.doubleValue(), node.getLayoutY());
        scene.widthProperty().addListener(xResizer);
    }
    if (nodeY != 0.0) {
        ChangeListener<Number> yResizer = (arg0, oldValue, newValue) -> node.relocate(node.getLayoutX(), nodeY / sceneHeight * newValue.doubleValue());
        scene.heightProperty().addListener(yResizer);
    }
}
 
Example 34
Project: dialog-tool   File: GiveQuestTransitionController.java   Source Code and License 6 votes vote down vote up
@Override
public void init(Stage stage, Scene scene, Pane pane) {
    addButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            //add transition

            String questName = questNameTextField.getText();

            if (questName.isEmpty()) {
                return;
            }

            GiveQuestTransition transition = new GiveQuestTransition(questName);
            entry.getTranstionList(index).add(transition);

            //refresh listview
            paneController.refreshListView();

            stage.close();
        }
    });
}
 
Example 35
Project: ChessBot   File: ChessBotAppSplash.java   Source Code and License 6 votes vote down vote up
private void showMainStage() {        
    mainStage = new Stage(StageStyle.DECORATED);
    mainStage.setTitle("Chess Bot");
    mainStage.setResizable(false);
    mainStage.setAlwaysOnTop(true);
    mainStage.setOnCloseRequest(event -> {
        Platform.exit();
        System.exit(0);
    });
    mainStage.getIcons().add(new Image(APPLICATION_ICON));
    mainStage.setScene(new Scene(PageResources.getRoot(PagePath.PATH_SCREEN_APPLICATION), 208, 491));
    mainStage.show();
}
 
Example 36
Project: FYS_T3   File: homepageController.java   Source Code and License 6 votes vote down vote up
/**
 *
 * @author shabier
 */
    @FXML
    public void openHome(ActionEvent event) throws IOException {
//        MyJDBC.createTestDatabase("shabo");
        Node node = (Node) event.getSource();
        final Stage stage = (Stage) node.getScene().getWindow();
        Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();
        stage.centerOnScreen();

        final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
        final Scene hScene = new Scene(home);
        root.setOnKeyPressed(new EventHandler<KeyEvent>() {
            public void handle(KeyEvent ke) {
                if (ke.getCode() == KeyCode.ESCAPE) {
                    System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                    stage.setScene(hScene);
                }
            }
        });
    }
 
Example 37
Project: MythRedisClient   File: ShowPanel.java   Source Code and License 6 votes vote down vote up
/** 显示值输入窗口.
 *  @param isNum 是否选择整数类型, true为整数, false为字符串
 */
public boolean showValuePanel(boolean isNum) {
    // 创建 FXMLLoader 对象
    FXMLLoader loader = new FXMLLoader();
    // 加载文件
    loader.setLocation(this.getClass().getResource("/views/ListAddLayout.fxml"));
    AnchorPane pane = null;
    try {
        pane = loader.load();
    } catch (IOException e) {
        e.printStackTrace();
    }
    // 创建对话框
    Stage dialogStage = new Stage();
    dialogStage.setTitle("添加值");
    dialogStage.initModality(Modality.WINDOW_MODAL);
    Scene scene = new Scene(pane);
    dialogStage.setScene(scene);

    controller = loader.getController();
    controller.setDialogStage(dialogStage);
    if (isNum) {
        controller.setTipText("输入0便立即删除\n-1 则永久存活 \n-2 则不存在");
        controller.setFlag("number");
    }

    // 显示对话框, 并等待, 直到用户关闭
    dialogStage.showAndWait();

    return controller.isOkChecked();
}
 
Example 38
Project: Dr-Assistant   File: SettingController.java   Source Code and License 5 votes vote down vote up
@FXML
private void handleChangePassword(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/view/auth/ChangePassword.fxml"));
    root.getStylesheets().add("../css/main.css");
    Scene scene = new Scene(root);
    Stage stage = new Stage();
    stage.setResizable(false);
    stage.setScene(scene);
    stage.show();
}
 
Example 39
Project: AlphaLab   File: Main.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) {
	login = primaryStage;
	StackPane frmPrincipal = null;

	try {
		frmPrincipal = FXMLLoader.load(FrmLogin.class.getClassLoader().getResource("gui//FrmLogin.fxml"),
				ResourceBundle.getBundle(FrmPrincipal.LINGUA_PORTUGUES));
	} catch (IOException ioe) {
		ioe.printStackTrace();
	}

	primaryStage.setTitle("AlphaLab");
	primaryStage.setWidth(1024);
	primaryStage.setHeight(768);

	Scene scene = new Scene(frmPrincipal);
	primaryStage.setScene(scene);

	primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
		@Override
		public void handle(WindowEvent t) {
			System.exit(0);
		}
	});

	primaryStage.show();
}
 
Example 40
Project: GameAuthoringEnvironment   File: LoginView.java   Source Code and License 5 votes vote down vote up
/**
 * Opens browser up in new stage
 *
 * @param myPage
 */
private void openStage (WebView myPage) {
    Stage stage = new Stage();
    BorderPane pane = new BorderPane();
    pane.setCenter(myPage);
    stage.setScene(new Scene(pane, BROWSER_SIZE, BROWSER_SIZE));
    stage.show();
}