本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}