当前位置: 首页>>代码示例>>Java>>正文


Java Stage.centerOnScreen方法代码示例

本文整理汇总了Java中javafx.stage.Stage.centerOnScreen方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.centerOnScreen方法的具体用法?Java Stage.centerOnScreen怎么用?Java Stage.centerOnScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.stage.Stage的用法示例。


在下文中一共展示了Stage.centerOnScreen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openHelp

import javafx.stage.Stage; //导入方法依赖的package包/类
@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();
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:searchLugController.java

示例2: openHome

import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
public void openHome(ActionEvent event) throws IOException {
    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);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:22,代码来源:statisticsController.java

示例3: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage aPrimaryStage) throws Exception {
	
	FxMediaCatalog mediaCatalog = new FxMediaCatalog();
	Scene scene = new Scene(mediaCatalog, mediaCatalog.getFormMinResolution().getWidth(), mediaCatalog.getFormMinResolution().getHeight());
	aPrimaryStage.setTitle(FxMediaCatalogDemo.class.getSimpleName());
	aPrimaryStage.setScene(scene);
	aPrimaryStage.setMinWidth(mediaCatalog.getFormMinResolution().getWidth());
	aPrimaryStage.setMinHeight(mediaCatalog.getFormMinResolution().getHeight());
	aPrimaryStage.sizeToScene();
	aPrimaryStage.centerOnScreen();
	aPrimaryStage.show();
	//
	//mediaCatalog.getModel().onDeleteMedia().set(tagsItem -> { System.out.println("OnDeleteMedia: " + tagsItem); throw new RuntimeException("RE 123");});
	mediaCatalog.getModel().setCatalogLocation(getCatalogLocation());
	TreeItem<TagsItem> rootItem = mediaCatalog.getModel().getRootItem();
	rootItem.setValue(new TagsItem("ABC", "Media Item 1", "Media 1", "Description AAA"));
	TreeItem<TagsItem> childItem = new TreeItem<TagsItem>(new TagsItem("XYZ", "Media Item 2", "Media 2", "Description BBB"));
	rootItem.getChildren().add(childItem);
	childItem.getChildren().add(new TreeItem<TagsItem>(new TagsItem("MNL", "Media Item 3", "Media 3", "Description CCC")));
	//
	System.out.println("Catalog location: " + mediaCatalog.getModel().getCatalogLocation());
}
 
开发者ID:mikelaud,项目名称:fx-media-catalog,代码行数:24,代码来源:FxMediaCatalogDemo.java

示例4: loadImageArchiveEditor

import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void loadImageArchiveEditor() {
	try {
		FXMLLoader loader = new FXMLLoader(App.class.getResource("/ImageArchiveUI.fxml"));

		Parent root = loader.load();

		ImageArchiveController controller = loader.getController();

		Stage stage = new Stage();

		controller.setStage(stage);
		stage.setTitle("Image Archive Editor");
		Scene scene = new Scene(root);
		scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm());
		stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png")));
		stage.setScene(scene);
		stage.initStyle(StageStyle.TRANSPARENT);
		stage.setResizable(false);
		stage.centerOnScreen();
		stage.setTitle("Archive Editor");
		stage.show();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:nshusa,项目名称:rsam-gui,代码行数:27,代码来源:StoreController.java

示例5: 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

示例6: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    LoggingDomain.CONFIG.info("Java version: " + System.getProperty("java.version"));

    CalendarView calendarView = new CalendarView();
    calendarView.setToday(LocalDate.now());
    calendarView.setTime(LocalTime.now());
    calendarView.setShowDeveloperConsole(Boolean.getBoolean("calendarfx.developer"));

    GoogleCalendarAppView appView = new GoogleCalendarAppView(calendarView);
    appView.getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm());

    primaryStage.setTitle("Google Calendar");
    primaryStage.setScene(new Scene(appView));
    primaryStage.setWidth(1400);
    primaryStage.setHeight(950);
    primaryStage.centerOnScreen();
    primaryStage.show();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:20,代码来源:GoogleCalendarApp.java

示例7: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    Calendar calendar = new Calendar();
    calendar.setName("Google Calendar");
    calendar.setStyle(Calendar.Style.STYLE2);

    GoogleEntry entry = new GoogleEntry();
    entry.setTitle("Google Entry");
    entry.setCalendar(calendar);
    entry.setLocation("Bogota");

    ObservableList<Calendar> allCalendars = FXCollections.observableArrayList(calendar);

    GoogleEntryPopOverContentPane pane = new GoogleEntryPopOverContentPane(entry, allCalendars);

    primaryStage.setTitle("Google Calendar");
    Scene scene = new Scene(pane, 400, 600);
    scene.getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm());
    primaryStage.setScene(scene);
    primaryStage.sizeToScene();
    primaryStage.centerOnScreen();
    primaryStage.show();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:24,代码来源:HelloGoogleEntryPopOverContentPane.java

示例8: onResetEmployeePasswordButtonClicked

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 * Displays the reset password dialog for the currently selected employee.
 *
 * @throws IOException
 */
@FXML
private void onResetEmployeePasswordButtonClicked() throws IOException {
    Stage dialogStage = new Stage();
    FXMLLoader loader = new FXMLLoader(
        getClass().getResource("/fxml/ResetEmployeePasswordDialog.fxml")
    );
    Parent dialogRoot = loader.load();
    Scene resetPasswordDialog = new Scene(dialogRoot);
    dialogStage.getIcons().add(new Image("images/Logo.png"));
    dialogStage.setScene(resetPasswordDialog);
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    dialogStage.initOwner(resetEmployeePasswordButton.getScene().getWindow());
    dialogStage.setResizable(false);
    dialogStage.setTitle("Confirm");
    dialogStage.centerOnScreen();

    ResetEmployeePasswordDialogController c;
    c = (ResetEmployeePasswordDialogController) loader.getController();
    long employeeId = getSelectedEmployee().getId();
    c.setEmployeeId(employeeId);

    dialogStage.show();
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:29,代码来源:StaffAccountsScreenController.java

示例9: onEditPriceClickedButton

import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void onEditPriceClickedButton() throws IOException {

    Stage editPriceDialogStage = new Stage();
    Parent editPriceDialogRoot = FXMLLoader.load(
            getClass().getResource("/fxml/EditPriceDialog.fxml")
    );
    service = roomTableView.getSelectionModel().getSelectedItem();
    Scene editPriceDialog = new Scene(editPriceDialogRoot);

    editPriceDialogStage.getIcons().add(new Image("images/Logo.png"));
    editPriceDialogStage.setScene(editPriceDialog);
    editPriceDialogStage.initModality(Modality.APPLICATION_MODAL);
    editPriceDialogStage.initOwner(editPriceButton.getScene().getWindow());
    editPriceDialogStage.setResizable(false);
    editPriceDialogStage.setTitle("Edit Price");
    editPriceDialogStage.centerOnScreen();
    editPriceDialogStage.show();

}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:21,代码来源:EditPricesScreenController.java

示例10: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
    double x = Toolkit.getDefaultToolkit().getScreenSize().width * 0.75;
    double y = Toolkit.getDefaultToolkit().getScreenSize().height * 0.75;
    
    Parent root = FXMLLoader.load(getClass().getResource(GlobalConstants.MAIN_VIEW));
    
    Scene scene = new Scene(root,x,y);
    
    scene.getStylesheets().add(GlobalConstants.CSS);
    stage.setOnCloseRequest(event ->{
        File img = new File(LocalEnvironment.getLocalVar(Local.TMP));
        File[] files = img.listFiles();
        
        if(files != null){
            for(File f : files){
                if(f.getName().endsWith(".jpg") || f.getName().endsWith(".JPG")){
                    try {
                        Files.delete(f.toPath());
                    } catch (IOException ex) {
                        Logger.getLogger(MainApp.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
        System.exit(0);
    });
    
    stage.setMinWidth(x);
    stage.setMinHeight(y);
    stage.setTitle(GlobalConstants.TITLE);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();
}
 
开发者ID:Obsidiam,项目名称:amelia,代码行数:36,代码来源:MainApp.java

示例11: loadIn

import javafx.stage.Stage; //导入方法依赖的package包/类
public void loadIn(Stage stage) {
    try {

        Parent root = resetAndLoad();
        Scene scene = createScene(root);
        stage.setScene(scene);
        setupStage(stage);
        stage.show();
        stage.centerOnScreen();

    } catch (IOException e) {
        throw new LireLabException("Could not resetAndLoad fxml file", e);
    }
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:15,代码来源:FXML.java

示例12: openHome

import javafx.stage.Stage; //导入方法依赖的package包/类
/**
 *
 * @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);
                }
            }
        });
    }
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:27,代码来源:homepageController.java

示例13: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

    Platform.setImplicitExit(false);

    Injector.setConfigurationSource(config::getInjectionValue);
    Injector.setLogger(s -> LOG.info(s));
    Injector.setModelOrService(Logger.class, LOG);
    Injector.setModelOrService(HueSenseConfig.class, config);
    Injector.setModelOrService(DBManager.class, dbMan);
    Injector.setModelOrService(DataStore.class, store);
    Injector.setModelOrService(HueComm.class, hue);
    Injector.setModelOrService(LanComm.class, lan);
    Injector.setModelOrService(MailService.class, mailServ);

    ConnectingView connView = new ConnectingView();
    Scene scene = new Scene(connView.getView());
    scene.setFill(Color.WHITE);
    stage.setTitle("HueSense");
    final String uri = Thread.currentThread().getContextClassLoader().getResource("global.css").toExternalForm();
    scene.getStylesheets().add(uri);
    stage.initStyle(StageStyle.TRANSPARENT);
    stage.setScene(scene);
    stage.setAlwaysOnTop(true);
    stage.setResizable(false);

    stage.centerOnScreen();
    UIUtils.setIcon(stage);

    stage.show();

    hue.startConnecting();

}
 
开发者ID:dainesch,项目名称:HueSense,代码行数:35,代码来源:Launcher.java

示例14: start

import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
    stage.setTitle(APP_TITLE);
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setResizable(false);
    stage.centerOnScreen();
    Async.setStage(stage);
    Async.setScene(SPLASH_XML);
}
 
开发者ID:codingchili,项目名称:ethereum-ingest,代码行数:10,代码来源:Form.java

示例15: 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


注:本文中的javafx.stage.Stage.centerOnScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。