當前位置: 首頁>>代碼示例>>Java>>正文


Java Stage.setScene方法代碼示例

本文整理匯總了Java中javafx.stage.Stage.setScene方法的典型用法代碼示例。如果您正苦於以下問題:Java Stage.setScene方法的具體用法?Java Stage.setScene怎麽用?Java Stage.setScene使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.stage.Stage的用法示例。


在下文中一共展示了Stage.setScene方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javafx.stage.Stage; //導入方法依賴的package包/類
public void start(Stage primaryStage, ScrollPane rootLayout) throws Exception {
	primaryStage.setTitle("Change Hotkeys");
	Scene myScene = new Scene(rootLayout);
	ourStage = primaryStage;
	myScene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
		public void handle(KeyEvent event) {
			if (changeHotkey) {
				if (addHotkey(event, changeHotkeyFunction)) {
					changeHotkey = false;
				}
			}
		}
	});
	Label divider = new Label();
	HBox labelHbox = new HBox(divider);
	divider.setText("----These hotkeys are not changeable----");
	labelHbox.setAlignment(Pos.CENTER);
	for (String key : HOTKEYS) {
		hotkeyVBox.getChildren().add(hotkeys.get(key).getHotkeyHBox());
	}
	hotkeyVBox.getChildren().add(labelHbox);
	for (ImmutableHotkey hotkey : IMMUTABLE_HOTKEYS) {
		hotkeyVBox.getChildren().add(hotkey.getHotkeyHBox());
	}
	primaryStage.setScene(myScene);
}
 
開發者ID:ForJ-Latech,項目名稱:fwm,代碼行數:27,代碼來源:HotkeyController.java

示例2: start

import javafx.stage.Stage; //導入方法依賴的package包/類
public void start(Stage primaryStage) throws Exception {
	
	//Essa parte foi para apenas escrever algo no arquivo de disciplinas, para testar.
	//se a parte disciplina aptas da GUI estava certa.
	//Disciplina dis = new Disciplina("�lgebra ", 23);
	//DisciplinaController.getInstance().cadastrarDisciplina(dis);
	//.........................
	primaryStage.setTitle("Cadastro de Professores");
	pane = FXMLLoader.load(this.getClass().getResource("cadastroProfessorFXML.fxml"));
	menu = (MenuButton) pane.getChildren().get(8);
	adiciona();
	primaryStage.setScene(new Scene(pane));
	primaryStage.setResizable(false);
	primaryStage.show();
	
}
 
開發者ID:omniplatypus,項目名稱:Projeto-IP2,代碼行數:17,代碼來源:CadastroProfessor.java

示例3: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@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();
}
 
開發者ID:kmhasan-class,項目名稱:spring2017java,代碼行數:10,代碼來源:AnimationDemoSection3.java

示例4: goToCashCalculate

import javafx.stage.Stage; //導入方法依賴的package包/類
public void goToCashCalculate(double positionX, double positionY) {
	try {
		Stage CashCalculateStage = new Stage();
		Parent root = FXMLLoader.load(getClass().getResource("/view/CashCalculate.fxml"));
		Scene scene = new Scene(root,800,550);
		CashCalculateStage.setScene(scene);
		CashCalculateStage.setResizable(false);
		CashCalculateStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
		CashCalculateStage.setTitle("Cash Calculate");
		CashCalculateStage.setX(positionX);
		CashCalculateStage.setY(positionY);
		CashCalculateStage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:17,代碼來源:GoToOperation.java

示例5: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
	FXMLLoader loader = new FXMLLoader(getClass().getResource("/ph/kana/memory/ui/fxml/main-form.fxml"));
	Scene scene = new Scene(loader.load());

	setUserAgentStylesheet(STYLESHEET_MODENA);

	stage.setWidth(APP_WIDTH);
	stage.setMinWidth(APP_WIDTH);

	stage.setHeight(APP_HEIGHT);
	stage.setMinHeight(APP_HEIGHT);

	stage.setTitle("kana0011/password-locker");
	stage.setScene(scene);

	MainFormController controller = loader.<MainFormController>getController();
	controller.setHostServices(getHostServices());

	stage.show();
}
 
開發者ID:kana0011,項目名稱:symmetrical-memory,代碼行數:22,代碼來源:MainForm.java

示例6: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
	App.stage = stage;
	try {
		Parent root = FXMLLoader.load(App.class.getResource("/ui/Main.fxml"));
		Scene scene = new Scene(root);
		scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
		stage.setTitle("OSRS Data To 317 Converter");		
		stage.centerOnScreen();
		stage.setResizable(false);
		stage.sizeToScene();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.setScene(scene);	
		stage.getIcons().add(new Image(App.class.getResourceAsStream("/icons/icon.png")));
		stage.show();
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:nshusa,項目名稱:osrs-data-converter,代碼行數:20,代碼來源:App.java

示例7: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override public void start(Stage stage) {
    GridPane gridPane = new GridPane();
    gridPane.setPadding(new Insets(10));
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.add(lineChart, 0, 0);
    gridPane.add(areaChart, 1, 0);
    gridPane.add(smoothLineChart, 0, 1);
    gridPane.add(smoothAreaChart, 1, 1);
    gridPane.add(scatterChart, 0, 2);
    gridPane.add(donutChart, 1, 2);

    Scene scene = new Scene(new StackPane(gridPane));

    stage.setTitle("Charts");
    stage.setScene(scene);
    stage.show();

    timer.start();

    modificationThread.start();
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:23,代碼來源:ChartTest.java

示例8: freecellMenuClick

import javafx.stage.Stage; //導入方法依賴的package包/類
@FXML protected void freecellMenuClick() throws IOException {
	Stage main = (Stage) _gameMenu.getScene().getWindow();
	Parent freecellFXML = FXMLLoader.load(getClass().getResource("/fxml/freecellGame.fxml"));
	freecellFXML.getStylesheets().add("/stylesheets/freecellGame.css");
	Scene freecellScene = new Scene(freecellFXML);
	main.setOnCloseRequest(b -> {
		boolean response = ExitWindow.display("Confirm", "Are you sure you want to quit now?");
		if(response) main.close();
		b.consume();
	});
	main.setScene(freecellScene);
	main.show();
}
 
開發者ID:jarolrod,項目名稱:java-solitaire,代碼行數:14,代碼來源:root.java

示例9: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override public void start(final Stage stage) {
    stage.setTitle("Directory Chooser Sample");

    final DirectoryChooser directoryChooser = new DirectoryChooser();
    final Button openButton = new Button("Select a folder...");

    openButton.setOnAction((final ActionEvent e) -> {
        File file = directoryChooser.showDialog(stage);
        if (file != null) {
            openFile(file);
        }
    });

    final GridPane inputGridPane = new GridPane();

    GridPane.setConstraints(openButton, 0, 1);
    inputGridPane.setHgap(6);
    inputGridPane.setVgap(6);
    inputGridPane.getChildren().addAll(openButton);

    final Pane rootGroup = new VBox(12);
    rootGroup.getChildren().addAll(inputGridPane);
    rootGroup.setPadding(new Insets(12, 12, 12, 12));

    stage.setScene(new Scene(rootGroup));
    stage.show();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:28,代碼來源:DirectoryChooserSample.java

示例10: presentConnectToServerWindow

import javafx.stage.Stage; //導入方法依賴的package包/類
/**
 * Zeigt den Connect-Dialog an
 * @param e	Das Event
 */
public void presentConnectToServerWindow(Event e) {
	try {
		FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("connectToServer.fxml"));
		GridPane root = (GridPane)loader.load();
		connectToServerController = loader.getController();

		connectToServerController.setCompletedRunnable((run) -> {
			/*String ip = connectToServerController.getIpAdressTextField().getText();
			String port = connectToServerController.getPortTextField().getText();*/
			String ip = (String) UserDefaults.sharedDefaults().valueForKey(UserDefaults.ADRESS_KEY);
			int port = (int) UserDefaults.sharedDefaults().valueForKey(UserDefaults.PORT_KEY);
			String userID = (String)UserDefaults.sharedDefaults().valueForKey(UserDefaults.NAME_KEY);

			this.client = new Client(ip, port, userID);
			this.client.setDelegate(this);
			this.client.connect();

			connectToServerCallback = run;
		});

           connectToServerStage = new Stage();
           connectToServerStage.setResizable(false);
           connectToServerStage.setTitle("Connect to server");
           connectToServerStage.setScene(new Scene(root));
           connectToServerStage.show();
	} catch (IOException e1) {
		e1.printStackTrace();
	}
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:34,代碼來源:Controller.java

示例11: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override public void start(Stage primaryStage) {
    primaryStage.setTitle("TreeTable View Sample");
    primaryStage.setScene(new Scene(new TreeTableSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
    TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view");
    treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:TreeTableSampleApp.java

示例12: start

import javafx.stage.Stage; //導入方法依賴的package包/類
/**
 *
 * @param primaryStage
 */
@Override
public void start(Stage primaryStage) {
    gameManager = new GameManager();
    gameBounds = gameManager.getLayoutBounds();

    StackPane root = new StackPane(gameManager);
    root.getStyleClass().addAll("game-root");
    ChangeListener<Number> resize = (ov, v, v1) -> {
        double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight());
        gameManager.setScale(scale);
        gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d);
        gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d);
    };
    root.widthProperty().addListener(resize);
    root.heightProperty().addListener(resize);

    Scene scene = new Scene(root);
    scene.getStylesheets().add(CSS);
    addKeyHandler(scene);
    addSwipeHandlers(scene);

    if (isARMDevice()) {
        primaryStage.setFullScreen(true);
        primaryStage.setFullScreenExitHint("");
    }

    if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) {
        scene.setCursor(Cursor.NONE);
    }

    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN),
            visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN));
    primaryStage.setTitle("2048FX");
    primaryStage.setScene(scene);
    primaryStage.setMinWidth(gameBounds.getWidth() / 2d);
    primaryStage.setMinHeight(gameBounds.getHeight() / 2d);
    primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor);
    primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor);
    primaryStage.show();
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:46,代碼來源:Game2048.java

示例13: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception 
{
   Parent root = 
      FXMLLoader.load(getClass().getResource("ColorChooser.fxml"));
   
   Scene scene = new Scene(root);
   stage.setTitle("Color Chooser");
   stage.setScene(scene);
   stage.show();
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:12,代碼來源:ColorChooser.java

示例14: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
    view.setPrimaryStage(primaryStage);

    primaryStage.setTitle("Cassandra client");
    primaryStage.getIcons().add(new Image("cassandra_ico.png"));
    primaryStage.setScene(new Scene(view.getView()));
    primaryStage.setResizable(true);
    primaryStage.centerOnScreen();
    primaryStage.show();

    ((MainController) view.getController()).onWindowLoad();
}
 
開發者ID:Kindrat,項目名稱:cassandra-client,代碼行數:14,代碼來源:CassandraClientGUI.java

示例15: start

import javafx.stage.Stage; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("view.fxml"));
    
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
 
開發者ID:jescascela,項目名稱:Calculadora-JavaFx,代碼行數:8,代碼來源:Calculadora.java


注:本文中的javafx.stage.Stage.setScene方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。