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


Java Dialog.setY方法代码示例

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


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

示例1: initDialogPositioning

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static void initDialogPositioning(Dialog dialog) {

		final double windowX = applicationWindow == null ? 0.0 : applicationWindow.getX();
		final double windowY = applicationWindow == null ? 0.0 : applicationWindow.getY();

		// initially position the dialog on the window
		dialog.setX(windowX);
		dialog.setY(windowY);

		// after the dialog is visible we can move it to the middle of the window.
		dialog.setOnShown(e -> Platform.runLater(() -> {

			final double windowWidth = applicationWindow == null ? 1000 : applicationWindow.getWidth();
			final double windowHeight = applicationWindow == null ? 500 : applicationWindow.getHeight();

			final double dialogWidth = dialog.getWidth();
			final double dialogHeight = dialog.getHeight();

			final double offsetX = (windowWidth - dialogWidth) / 2;
			final double offsetY = (windowHeight - dialogHeight) / 2;

			final double dialogX = windowX + offsetX;
			final double dialogY = windowY + offsetY;

			dialog.setX(dialogX);
			dialog.setY(dialogY);
		}));
	}
 
开发者ID:lestard,项目名称:structured-list,代码行数:29,代码来源:DialogUtil.java

示例2: centerOnOwner

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public static void centerOnOwner(Dialog<?> dialog, Window owner) {
  dialog.setX(owner.getX() + owner.getWidth() / 2 - dialog.getWidth() / 2);
  dialog.setY(owner.getY() + owner.getHeight() / 2 - dialog.getHeight() / 2);
}
 
开发者ID:Adrodoc55,项目名称:MPL,代码行数:5,代码来源:JavaFxUtils.java

示例3: positionDialog

import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/** Position dialog relative to another widget
 *
 *  <p>By default, dialogs seem to pop up in the center of the first monitor.
 *  .. even if the "current" window is on a different monitor.
 *
 *  <p>This helper positions the dialog relative to the center
 *  of a node.
 *
 *  @param dialog Dialog to position
 *  @param node Node relative to which dialog should be positioned
 *  @param x_offset Offset relative to center of the node
 *  @param y_offset Offset relative to center of the node
 */
public static void positionDialog(final Dialog<?> dialog, final Node node, final int x_offset, final int y_offset)
{
    final Bounds pos = node.localToScreen(node.getBoundsInLocal());
    dialog.setX(pos.getMinX() + pos.getWidth()/2 + x_offset);
    dialog.setY(pos.getMinY() + pos.getHeight()/2 + y_offset);
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:20,代码来源:DialogHelper.java


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