Package javafx.util

Examples of javafx.util.Duration


  public void start(Stage primaryStage) throws Exception {
    Button button = new Button("BindableTransition");
    DropShadow shadow = DropShadowBuilder.create().build();
    button.setEffect(shadow);
    button.setStyle("-fx-font-size: 32px;");
    final Duration duration = Duration.millis(1200);
    BindableTransition transition = new BindableTransition(duration);
    transition.setCycleCount(1000);
    transition.setAutoReverse(true);
    shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32));
    shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32));
View Full Code Here


            stage.show();
            final DoubleProperty opacity = stage.opacityProperty();

            Timeline fadeIn = new Timeline(
                    new KeyFrame(Duration.ZERO, new KeyValue(opacity, 0d)),
                    new KeyFrame(new Duration(fadeInOutTime * 1000),
                            new EventHandler() {
                                @Override
                                public void handle(Event t) {
                                    Timeline display = new Timeline(
                                            new KeyFrame(Duration.ZERO, new KeyValue(opacity, 1d)),
                                            new KeyFrame(new Duration((displayTime - fadeInOutTime * 2) * 1000),
                                                    new EventHandler() {
                                                        @Override
                                                        public void handle(Event t) {
                                                            Timeline fadeOut = new Timeline(
                                                                    new KeyFrame(Duration.ZERO, new KeyValue(opacity, 1d)),
                                                                    new KeyFrame(new Duration(fadeInOutTime * 1000),
                                                                            new EventHandler() {
                                                                                @Override
                                                                                public void handle(Event t) {
                                                                                    stage.hide();
                                                                                }
View Full Code Here

    private void setDefaultButtonAnimation() {
        if (!getSkinnable().isDisabled()) {
            if (defaultButtonTransition != null && defaultButtonTransition.getStatus() == Status.RUNNING) {
                defaultButtonTransition.stop();
            } else {
                final Duration duration = Duration.millis(500);
                defaultButtonTransition = new BindableTransition(duration);
                defaultButtonTransition.setCycleCount(Timeline.INDEFINITE);
                defaultButtonTransition.setAutoReverse(true);

                // The gradient
View Full Code Here

    private void setIndeterminateProgressAnimation() {
        if (!getSkinnable().isDisabled()) {
            if (indeterminateProgressTransition != null && indeterminateProgressTransition.getStatus() == Status.RUNNING) {
                indeterminateProgressTransition.stop();
            } else {
                final Duration duration = Duration.millis(2000);
                indeterminateProgressTransition = new BindableTransition(duration);
                indeterminateProgressTransition.setCycleCount(Timeline.INDEFINITE);
                indeterminateProgressTransition.setAutoReverse(false);
                indeterminateProgressTransition.setInterpolator(Interpolator.LINEAR);
                indeterminateProgressTransition.fractionProperty().addListener(new ChangeListener<Number>() {
View Full Code Here

    private void setDeterminateProgressAnimation() {
        if (!getSkinnable().isDisabled()) {
            if (determinateProgressTransition != null && determinateProgressTransition.getStatus() == Status.RUNNING) {
                determinateProgressTransition.stop();
            } else {
                final Duration duration = Duration.millis(1000);
                determinateProgressTransition = new BindableTransition(duration);
                determinateProgressTransition.setCycleCount(Timeline.INDEFINITE);
                determinateProgressTransition.setAutoReverse(false);
                determinateProgressTransition.setInterpolator(Interpolator.LINEAR);
                determinateProgressTransition.fractionProperty().addListener(new ChangeListener<Number>() {
View Full Code Here

    stage.setScene(scene);
    stage.show();

    int refreshMillis = 1000;

    final Duration oneFrameAmt = Duration.millis(refreshMillis);

    final KeyFrame oneFrame = new KeyFrame(oneFrameAmt, new EventHandler<ActionEvent>()
    {
      @Override
      public void handle(ActionEvent arg0)
View Full Code Here

        lblPoints.setTranslateX(lblPoints.sceneToLocal(posX, 0).getX()-lblPoints.getWidth()/2d);
        lblPoints.setLayoutY(20);
        final KeyValue kvO = new KeyValue(lblPoints.opacityProperty(), 0);
        final KeyValue kvY = new KeyValue(lblPoints.layoutYProperty(), 100);

        Duration animationDuration = Duration.millis(600);
        final KeyFrame kfO = new KeyFrame(animationDuration, kvO);
        final KeyFrame kfY = new KeyFrame(animationDuration, kvY);

        timeline.getKeyFrames().add(kfO);
        timeline.getKeyFrames().add(kfY);
View Full Code Here

        FXMLConstructor.construct(this, "MediaControl.fxml");
    }

    protected void updateTime() {
        Platform.runLater(() -> {
            Duration currentTime = mp.getCurrentTime();
            timeSlider.setDisable(duration.isUnknown());
            timeLabel.setText(formatTime(currentTime));
            if (!timeSlider.isDisabled()
                    && duration.greaterThan(Duration.ZERO)
                    && !timeSlider.isValueChanging()) {
                timeSlider.valueProperty().removeListener(seekListener);
                timeSlider.setValue(currentTime.toMillis());
                timeSlider.valueProperty().addListener(seekListener);
            }

        });
    }
View Full Code Here

        /**
         * Update the progress slider and label with the current time of the
         * media.
         */
        private void updateProgress() {
            Duration currentTime = mediaPlayer.getCurrentTime();
            updateSlider(currentTime);
            updateTime(currentTime);
        }
View Full Code Here

         */
        private class EndOfMediaListener implements Runnable {

            @Override
            public void run() {
                Duration beginning = mediaPlayer.getStartTime();
                mediaPlayer.stop();
                mediaPlayer.pause();
                pauseButton.setText(PLAY_TEXT);
                updateSlider(beginning);
                updateTime(beginning);
View Full Code Here

TOP

Related Classes of javafx.util.Duration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.