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


Java Stage.getHeight方法代碼示例

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


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

示例1: populateRenderCells

import javafx.stage.Stage; //導入方法依賴的package包/類
private void populateRenderCells(Group squares, Stage primaryScene) {
    int SPACING = 1;

    screenCenter = new Point((int) primaryScene.getWidth() / (2 * (sideSize + SPACING)),
            (int) primaryScene.getHeight() / (2 * (sideSize + SPACING)));
    renderMap = new HashMap<>();

    for (int y = 0; y < height / (sideSize + SPACING); y++) {
        for (int x = 0; x < width / (sideSize + SPACING); x++) {
            Point position = new Point(x, y).minus(screenCenter);
            Rectangle square = new Rectangle(sideSize, sideSize, Color.BLACK);
            square.setX(x * (sideSize + SPACING));
            square.setY(y * (sideSize + SPACING));
            if (!position.isOrigin()) {
                renderMap.put(position, square);
            } else {
                square.setFill(Color.ORANGE);
            }
            squares.getChildren().add(square);
        }
    }
}
 
開發者ID:slemonide,項目名稱:GraphSpace,代碼行數:23,代碼來源:Main.java

示例2: ProgressBarView

import javafx.stage.Stage; //導入方法依賴的package包/類
/**
 * Create instance of {@link ProgressBarView}.
 */
public ProgressBarView() {
    try {
        final Stage newStage = new Stage();
        newStage.setResizable(false);

        final URL resource = getClass().getResource(PROGRESS_BAR_VIEW);
        fxmlLoader = new FXMLLoader(resource);

        final Stage primaryStage = Hygene.getInstance().getPrimaryStage();
        newStage.initOwner(primaryStage);
        newStage.initStyle(StageStyle.UTILITY);
        newStage.initModality(Modality.APPLICATION_MODAL);

        final double centerXPosition = primaryStage.getX() + primaryStage.getWidth() / 2;
        final double centerYPosition = primaryStage.getY() + primaryStage.getHeight() / 2;

        newStage.setOnShowing(event -> newStage.hide());
        newStage.setOnShown(event -> {
            newStage.setX(centerXPosition - newStage.getWidth() / 2);
            newStage.setY(centerYPosition - newStage.getHeight() / 2);
            newStage.show();
        });

        setStage(newStage);
    } catch (final UIInitialisationException e) {
        LOGGER.error("Progress bar view could not be loaded.", e);
    }
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:32,代碼來源:ProgressBarView.java

示例3: create

import javafx.stage.Stage; //導入方法依賴的package包/類
public void create(Stage primaryStage) {
    this.primaryStage = primaryStage;
    FunnyCreator.getLogger().info("Creating primary view");

    ScreenUtils.to(primaryStage, 960, 480);
    ScreenUtils.center(primaryStage);

    WebView view = new WebView();
    this.engine = view.getEngine();

    engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != State.SUCCEEDED) {
            return;
        }

        FunnyCreator.getLogger().info("Showing view");
        primaryStage.show();

        FunnyCreator.getLogger().info("Injecting FGC bridge");
        JSObject window = (JSObject) engine.executeScript("window");
        window.setMember("FunnyGuildsCreator", new FunnyBridge());

        creator.runAsync(() -> {
            try {
                creator.load();
            } catch (Exception e) {
                e.printStackTrace();
                AlertUtils.alert("FunnyCreator Exception", "Cannot load creator", ExceptionUtils.getStackTrace(e), creator::shutdown);
            }
        });
    });

    String style = IOUtils.toString(getClass().getResourceAsStream("/panel/front.css"), Charset.forName("UTF-8"));
    String script = IOUtils.toString(getClass().getResourceAsStream("/panel/front.js"), Charset.forName("UTF-8"));
    String html = IOUtils.toString(getClass().getResourceAsStream("/panel/front.html"), Charset.forName("UTF-8"));

    String content = html
            .replace("{{STYLE}}", style)
            .replace("{{SCRIPT}}", script)
            .replace("{{VERSION}}", FunnyConstants.VERSION);
    engine.loadContent(content);

    Scene scene = new Scene(view, primaryStage.getWidth(), primaryStage.getHeight());
    primaryStage.getIcons().add(new Image(FunnyCreator.class.getResourceAsStream("/icon.png")));
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.setTitle("FunnyGuilds Creator " + FunnyConstants.VERSION);
    primaryStage.setScene(scene);
}
 
開發者ID:FunnyGuilds,項目名稱:FunnyCreator,代碼行數:49,代碼來源:FunnyView.java


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