本文整理匯總了Java中javafx.geometry.Pos.getVpos方法的典型用法代碼示例。如果您正苦於以下問題:Java Pos.getVpos方法的具體用法?Java Pos.getVpos怎麽用?Java Pos.getVpos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.geometry.Pos
的用法示例。
在下文中一共展示了Pos.getVpos方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: moveTo
import javafx.geometry.Pos; //導入方法依賴的package包/類
@Override
public RNode<T> moveTo(Duration d, Pos referencePoint, double _x, double _y) {
double x;
double y;
Bounds bounds = node.localToScreen(node.getBoundsInLocal());
switch (referencePoint.getHpos()) {
case CENTER:
x = bounds.getMinX() + bounds.getWidth()/2;
break;
case RIGHT:
x = bounds.getMaxX();
break;
default:
x = bounds.getMinX();
break;
}
switch (referencePoint.getVpos()) {
case BOTTOM:
case BASELINE:
y = bounds.getMaxY();
break;
case CENTER:
y = bounds.getMinY() + bounds.getHeight()/2;
break;
default:
y = bounds.getMinY();
break;
}
controller.run(Move.to(d, x+_x, y+_y));
return this;
}
示例2: location
import javafx.geometry.Pos; //導入方法依賴的package包/類
@Override
public Point2D location(Pos position) {
double x;
double y;
Bounds bounds = node.localToScreen(node.getBoundsInLocal());
switch (position.getHpos()) {
case CENTER:
x = bounds.getMinX() + bounds.getWidth()/2;
break;
case RIGHT:
x = bounds.getMaxX();
break;
default:
x = bounds.getMinX();
break;
}
switch (position.getVpos()) {
case BOTTOM:
case BASELINE:
y = bounds.getMaxY();
break;
case CENTER:
y = bounds.getMinY() + bounds.getHeight()/2;
break;
default:
y = bounds.getMinY();
break;
}
return new Point2D(x, y);
}