本文整理汇总了Java中javafx.beans.property.DoubleProperty.get方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleProperty.get方法的具体用法?Java DoubleProperty.get怎么用?Java DoubleProperty.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.beans.property.DoubleProperty
的用法示例。
在下文中一共展示了DoubleProperty.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startPanAnimation
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
private void startPanAnimation(double velocity, Timeline timeline, DoubleProperty animatedPan, DoubleProperty pan) {
if (isRunning(timeline)) {
return;
}
double durationInMillis = 1e10;
double distance = velocity * durationInMillis;
animatedPan.set(pan.get());
KeyValue keyValue = new KeyValue(animatedPan, animatedPan.get() - distance);
KeyFrame keyFrame = new KeyFrame(Duration.millis(durationInMillis), keyValue);
timeline.getKeyFrames().setAll(keyFrame);
timeline.playFromStart();
}
示例2: PropDesc
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
public PropDesc(String name, DoubleProperty valueModel, Double min, Double max) {
this.name = name;
this.valueModel = valueModel;
this.initialValue = valueModel.get();
this.min = min;
this.max = max;
}
示例3: EditableText
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
public EditableText(DoubleProperty xProperty, DoubleProperty yProperty) {
this(xProperty.get(), yProperty.get());
dragHandler = new DragHandler(this);
dragHandler.bindToPoint(this);
dragHandler.bindToPoint(xProperty, yProperty);
this.setOnMousePressed(dragHandler.getOnPressed());
this.setOnMouseDragged(dragHandler.getOnDragged());
}
示例4: bindToPoint
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
/**
* 綁定位移座標
* 註:通常是需要在拖曳時同步更新 model 才會用到,如果是釋放拖曳才要更新的話就不會用到這個方法
* @param xProperty
* @param yProperty
*/
public void bindToPoint(DoubleProperty xProperty, DoubleProperty yProperty) {
double initX = xProperty.get();
double initY = yProperty.get();
translateX.addListener(((observable, oldValue, newValue) -> {
xProperty.set(initX + (double)newValue);
}));
translateY.addListener(((observable, oldValue, newValue) -> {
yProperty.set(initY + (double)newValue);
}));
}
示例5: downloadFile
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
/**
* Downloads a file and saves it at the given location.
*
* @param url
* the url to download from
* @param outputPath
* the path where to save the downloaded file
* @param progressProperty
* a property that will contain the current download process from 0.0 to 1.0
* @param fileLength
* length of the file
* @return the downloaded file
* @throws IOException
* if an errors occurs while writing the file or opening the stream
*/
public static File downloadFile(final URL url, final String outputPath, final DoubleProperty progressProperty, final double fileLength) throws IOException {
try (final InputStream input = url.openStream(); final FileOutputStream fileOutputStream = new FileOutputStream(outputPath);) {
final double currentProgress = (int) progressProperty.get();
final byte[] buffer = new byte[10000];
while (true) {
final double length = input.read(buffer);
if (length <= 0) {
break;
}
/*
* Setting the progress property inside of a run later in order to avoid a crash,
* since this function is usually used inside of a different thread than the ui
* thread.
*/
Platform.runLater(() -> {
final double additional = length / fileLength * (1.0 - currentProgress);
progressProperty.set(progressProperty.get() + additional);
});
fileOutputStream.write(buffer, 0, (int) length);
}
return new File(outputPath);
}
}
示例6: StraightEdgeView
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
public StraightEdgeView(DoubleProperty sX, DoubleProperty sY, DoubleProperty eX, DoubleProperty eY) {
super(sX, sY, eX, eY);
aX = new DoubleBinding() {
{
super.bind(sX, eX);
}
@Override
protected double computeValue() {
return (sX.get() + eX.get()) * .5;
}
};
aY = new DoubleBinding() {
{
super.bind(sY, eY);
}
@Override
protected double computeValue() {
return (sY.get() + eY.get()) * .5;
}
};
Line line = new Line();
line.setStrokeWidth(1.5);
line.setStroke(Color.BLUE);
line.startXProperty().bind(sX);
line.startYProperty().bind(sY);
line.endXProperty().bind(eX);
line.endYProperty().bind(eY);
Polygon arrow = new Polygon();
arrow.setFill(Color.BLUE);
final ChangeListener<Number> listener = (_0, _1, _2) -> {
final double angle = a.get() + Math.PI;
final double x = aX.get();
final double y = aY.get();
final double x0 = x + 5 * Math.cos(angle);
final double x1 = x + 5 * Math.cos(angle + 2 * Math.PI / 3);
final double x2 = x + 5 * Math.cos(angle - 2 * Math.PI / 3);
final double y0 = y + 5 * Math.sin(angle);
final double y1 = y + 5 * Math.sin(angle + 2 * Math.PI / 3);
final double y2 = y + 5 * Math.sin(angle - 2 * Math.PI / 3);
arrow.getPoints().clear();
arrow.getPoints().addAll(x0, y0, x1, y1, x2, y2);
};
aX.addListener(listener);
aY.addListener(listener);
getChildren().addAll(line, arrow);
}
示例7: DragPoint
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
public DragPoint(DoubleProperty xProperty, DoubleProperty yProperty) {
super(xProperty.get(), yProperty.get(), 5);
this.getStyleClass().add("transition-drag-point");
dragHandler.bindToPoint(this);
dragHandler.bindToPoint(xProperty, yProperty);
}