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


Java DoubleProperty.get方法代码示例

本文整理汇总了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();
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:13,代码来源:DragBehavior.java

示例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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:SimplePropertySheet.java

示例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());
}
 
开发者ID:ucfan,项目名称:DiaEd,代码行数:10,代码来源:EditableText.java

示例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);
    }));
}
 
开发者ID:ucfan,项目名称:DiaEd,代码行数:19,代码来源:DragHandler.java

示例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);
	}
}
 
开发者ID:Bios-Marcel,项目名称:ServerBrowser,代码行数:43,代码来源:FileUtility.java

示例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);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:57,代码来源:StraightEdgeView.java

示例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);
}
 
开发者ID:ucfan,项目名称:DiaEd,代码行数:7,代码来源:TransitionView.java


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