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


Java Duration.greaterThan方法代码示例

本文整理汇总了Java中javafx.util.Duration.greaterThan方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.greaterThan方法的具体用法?Java Duration.greaterThan怎么用?Java Duration.greaterThan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.util.Duration的用法示例。


在下文中一共展示了Duration.greaterThan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: formatTime

import javafx.util.Duration; //导入方法依赖的package包/类
private String formatTime(Duration elapsed, Duration duration) {
    int intElapsed = (int)Math.floor(elapsed.toSeconds());
    int elapsedHours = intElapsed / (60 * 60);
    if (elapsedHours > 0) {
        intElapsed -= elapsedHours * 60 * 60;
    }
    int elapsedMinutes = intElapsed / 60;
    int elapsedSeconds = intElapsed - elapsedHours * 60 * 60 - elapsedMinutes * 60;

    if (duration.greaterThan(Duration.ZERO)) {
        int intDuration = (int)Math.floor(duration.toSeconds());
        int durationHours = intDuration / (60 * 60);
        if (durationHours > 0) {
            intDuration -= durationHours * 60 * 60;
        }
        int durationMinutes = intDuration / 60;
        int durationSeconds = intDuration - durationHours * 60 * 60 - durationMinutes * 60;

        if (durationHours > 0) {
            return String.format("%d:%02d:%02d/%d:%02d:%02d",
                                 elapsedHours, elapsedMinutes, elapsedSeconds,
                                 durationHours, durationMinutes, durationSeconds);
        } else {
            return String.format("%02d:%02d/%02d:%02d",
                                 elapsedMinutes, elapsedSeconds,
                                 durationMinutes, durationSeconds);
        }
    } else {
        if (elapsedHours > 0) {
            return String.format("%d:%02d:%02d",
                                 elapsedHours, elapsedMinutes, elapsedSeconds);
        } else {
            return String.format("%02d:%02d",
                                 elapsedMinutes, elapsedSeconds);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:AdvancedMedia.java

示例2: formatTime

import javafx.util.Duration; //导入方法依赖的package包/类
private static String formatTime(Duration elapsed, Duration duration) {
    int intElapsed = (int)Math.floor(elapsed.toSeconds());
    int elapsedHours = intElapsed / (60 * 60);
    if (elapsedHours > 0) {
        intElapsed -= elapsedHours * 60 * 60;
    }
    int elapsedMinutes = intElapsed / 60;
    int elapsedSeconds = intElapsed - elapsedHours * 60 * 60 - elapsedMinutes * 60;

    if (duration.greaterThan(Duration.ZERO)) {
        int intDuration = (int)Math.floor(duration.toSeconds());
        int durationHours = intDuration / (60 * 60);
        if (durationHours > 0) {
            intDuration -= durationHours * 60 * 60;
        }
        int durationMinutes = intDuration / 60;
        int durationSeconds = intDuration - durationHours * 60 * 60 - durationMinutes * 60;

        if (durationHours > 0) {
            return String.format("%d:%02d:%02d",
                                 elapsedHours, elapsedMinutes, elapsedSeconds);
        } else {
            return String.format("%02d:%02d",
                                 elapsedMinutes, elapsedSeconds);
        }
    } else {
        if (elapsedHours > 0) {
            return String.format("%d:%02d:%02d",
                                 elapsedHours, elapsedMinutes, elapsedSeconds);
        } else {
            return String.format("%02d:%02d",
                                 elapsedMinutes, elapsedSeconds);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:StreamingMediaPlayer.java

示例3: formatTime

import javafx.util.Duration; //导入方法依赖的package包/类
private static String formatTime(Duration elapsed, Duration duration) {
    int intElapsed = (int) Math.floor(elapsed.toSeconds());
    int elapsedHours = intElapsed / (60 * 60);
    if (elapsedHours > 0) {
        intElapsed -= elapsedHours * 60 * 60;
    }
    int elapsedMinutes = intElapsed / 60;
    int elapsedSeconds = intElapsed - elapsedHours * 60 * 60
            - elapsedMinutes * 60;

    if (duration.greaterThan(Duration.ZERO)) {
        int intDuration = (int) Math.floor(duration.toSeconds());
        int durationHours = intDuration / (60 * 60);
        if (durationHours > 0) {
            intDuration -= durationHours * 60 * 60;
        }
        int durationMinutes = intDuration / 60;
        int durationSeconds = intDuration - durationHours * 60 * 60
                - durationMinutes * 60;
        if (durationHours > 0) {
            return String.format("%d:%02d:%02d/%d:%02d:%02d",
                    elapsedHours, elapsedMinutes, elapsedSeconds,
                    durationHours, durationMinutes, durationSeconds);
        } else {
            return String.format("%02d:%02d/%02d:%02d",
                    elapsedMinutes, elapsedSeconds, durationMinutes,
                    durationSeconds);
        }
    } else {
        if (elapsedHours > 0) {
            return String.format("%d:%02d:%02d", elapsedHours,
                    elapsedMinutes, elapsedSeconds);
        } else {
            return String.format("%02d:%02d", elapsedMinutes,
                    elapsedSeconds);
        }
    }
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:39,代码来源:MediaControl.java

示例4: formatTime

import javafx.util.Duration; //导入方法依赖的package包/类
/**
 * format the times
 * 
 * @param elapsed
 * @param duration
 * @return
 */
public String formatTime(Duration elapsed, Duration duration) {
  if (duration.greaterThan(Duration.ZERO)) {
    return getTimeString(elapsed.toSeconds()) + "/"
        + getTimeString(duration.toSeconds());
  } else {
    return "";
  }
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:16,代码来源:SimulatorPane.java


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