Java 类javafx.scene.Scene 实例源码

项目:alchem    文件:AlertBox.java   
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) {
    }
}
项目:spring2017java    文件:AnimationDemoSection3.java   
@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();
}
项目:strongbox    文件:StrongboxGUI.java   
@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();
}
项目:gemoc-studio-modeldebugging    文件:EventManagerViewPart.java   
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) -> {

    });
}
项目:GazePlay    文件:Stats.java   
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];
}
项目:MakeSourceList4j    文件:Main.java   
@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();
}
项目:AquamarineLake    文件:App.java   
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();

}
项目:CyberTigerScoreboard    文件:CPscorereport.java   
@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
}
项目:Money-Manager    文件:GoToOperation.java   
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();
    }
}
项目:Notebook    文件:App.java   
@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();
    }
}
项目:javafx-3d-surface-chart    文件:Mesh3DChartPanel.java   
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();
    });
}
项目:marathonv5    文件:HTMLEditorSample.java   
@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();
}
项目:Orsum-occulendi    文件:Main.java   
@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();
    }
}
项目:ChessBot    文件:ChessBotAppSplash.java   
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();
}
项目:erp-frontend    文件:StageFactory.java   
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;
}
项目:CDN-FX-2.2    文件:CDNFXController.java   
@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);
    }
}
项目:can4eve    文件:ClockControl.java   
@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");
}
项目:WholesomeChat    文件:MainController.java   
@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));
    }
}
项目:Calculadora-JavaFx    文件:Calculadora.java   
@Override
public void start(Stage primaryStage) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("view.fxml"));

    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
项目:file-transfer    文件:HtmlPage.java   
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);
}
项目:FYS_T3    文件:statisticsController.java   
@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();
            }
        }
    });
}
项目:FYS_T3    文件:homepageController.java   
@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);
            }
        }
    });
}
项目:Projeto-IP2    文件:SubmenuAjustes.java   
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();
}
项目:grpc-samples-java    文件:ChatClient.java   
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();
}
项目:TextClassifier    文件:MainWindow.java   
private void buildForm(Stage primaryStage) {
  textAreaClassifiableText = new TextArea();
  textAreaClassifiableText.setWrapText(true);

  btnClassify = new Button("Classify");
  btnClassify.setOnAction(new ClassifyBtnPressEvent());

  lblCharacteristics = new Label("");

  root = new FlowPane(Orientation.VERTICAL, 10, 10);
  root.setAlignment(Pos.BASELINE_CENTER);
  root.getChildren().addAll(textAreaClassifiableText, btnClassify, lblCharacteristics);

  primaryStage.setScene(new Scene(root, 500, 300));
  primaryStage.show();
}
项目:FYS_T3    文件:homepageController.java   
@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);
            }
        }
    });
}
项目:WholesomeChat    文件:App.java   
@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();

}
项目:Money-Manager    文件:GoToRegistration.java   
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();
    }
}
项目:Coconut-IDE    文件:RenameFilePlace.java   
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();
}
项目:Himalaya-JavaFX    文件:MainFXMLController.java   
@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();

}
项目:Goliath-Overclocking-Utility-FX    文件:GoliathOUFX.java   
@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();
}
项目:hygene    文件:Hygene.java   
@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");
}
项目:IO    文件:BaseController.java   
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);
    }
}
项目:dialog-tool    文件:GiveQuestTransitionController.java   
@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();
        }
    });
}
项目:ChessBot    文件:ChessBotAppSplash.java   
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();
}
项目:FYS_T3    文件:homepageController.java   
/**
 *
 * @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);
                }
            }
        });
    }
项目:MythRedisClient    文件:ShowPanel.java   
/** 显示值输入窗口.
 *  @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();
}
项目:Dr-Assistant    文件:SettingController.java   
@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();
}
项目:AlphaLab    文件:Main.java   
@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();
}
项目:GameAuthoringEnvironment    文件:LoginView.java   
/**
 * 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();
}