当前位置: 首页>>代码示例>>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;未经允许,请勿转载。