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