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


Java DoubleProperty.bind方法代码示例

本文整理汇总了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")); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:36,代码来源:VideoPlayerController.java

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

示例3: bindProgress

import javafx.beans.property.DoubleProperty; //导入方法依赖的package包/类
/**
 * {@link #progressProperty()}
 */
public CompletableService<T> bindProgress(DoubleProperty progress) {
    progress.bind(progressProperty());
    return this;
}
 
开发者ID:comtel2000,项目名称:mokka7,代码行数:8,代码来源:CompletableService.java


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