本文整理汇总了Java中javafx.beans.property.DoubleProperty.bind方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleProperty.bind方法的具体用法?Java DoubleProperty.bind怎么用?Java DoubleProperty.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.beans.property.DoubleProperty
的用法示例。
在下文中一共展示了DoubleProperty.bind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
public void initialize()
{
// get URL of the video file
URL url = VideoPlayerController.class.getResource("sts117.mp4");
// create a Media object for the specified URL
Media media = new Media(url.toExternalForm());
// create a MediaPlayer to control Media playback
mediaPlayer = new MediaPlayer(media);
// specify which MediaPlayer to display in the MediaView
mediaView.setMediaPlayer(mediaPlayer);
// set handler to be called when the video completes playing
mediaPlayer.setOnEndOfMedia(() -> {
playing = false;
playPauseButton.setText("Play");
});
// set handler that displays an ExceptionDialog if an error occurs
mediaPlayer.setOnError(() -> {
ExceptionDialog dialog =
new ExceptionDialog(mediaPlayer.getError());
dialog.showAndWait();
});
// bind the MediaView's width/height to the scene's width/height
DoubleProperty width = mediaView.fitWidthProperty();
DoubleProperty height = mediaView.fitHeightProperty();
width.bind(Bindings.selectDouble(
mediaView.sceneProperty(), "width"));
height.bind(Bindings.selectDouble(
mediaView.sceneProperty(), "height"));
}
示例2: changeControlWidthPercent
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
@Override
@FXThread
public void changeControlWidthPercent(final double controlWidthPercent) {
final CheckBox checkBox = getCheckBox();
final DoubleProperty widthProperty = checkBox.prefWidthProperty();
if (widthProperty.isBound()) {
super.changeControlWidthPercent(controlWidthPercent);
widthProperty.unbind();
widthProperty.bind(widthProperty().multiply(controlWidthPercent));
}
}
示例3: bindProgress
import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
/**
* {@link #progressProperty()}
*/
public CompletableService<T> bindProgress(DoubleProperty progress) {
progress.bind(progressProperty());
return this;
}