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