本文整理汇总了Java中javafx.stage.Stage.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.getY方法的具体用法?Java Stage.getY怎么用?Java Stage.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.getY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: calculateGap
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Calculating gap of location between the mouse and the stage on <i>Mouse Moving Event</i>.
* @param event
* @param stage
*/
private void calculateGap(MouseEvent event, Stage stage) {
gap_x = event.getScreenX() - stage.getX();
gap_y = event.getScreenY() - stage.getY();
}