Example usage for javafx.animation KeyFrame KeyFrame

List of usage examples for javafx.animation KeyFrame KeyFrame

Introduction

In this page you can find the example usage for javafx.animation KeyFrame KeyFrame.

Prototype

public KeyFrame(@NamedArg("time") Duration time, @NamedArg("values") KeyValue... values) 

Source Link

Document

Constructor of KeyFrame

Usage

From source file:mesclasses.view.RootLayoutController.java

private void displayNotification(int type, String texte) {
    notificationMessageLabel.setText(texte);
    notificationPane.getStyleClass().clear();
    CssUtil.removeClass(deleteNotifBtn, "notif-warning");
    CssUtil.removeClass(deleteNotifBtn, "notif-error");
    Double timeDisplayed = 3.0D;//from w  w w. j a va 2 s . com
    switch (type) {
    case MessageEvent.SUCCESS:
        CssUtil.addClass(notificationPane, "notif-success");
        deleteNotifBtn.setManaged(false);
        deleteNotifBtn.setVisible(false);
        notificationTitleLabel.setText("SUCCES");
        break;
    case MessageEvent.WARNING:
        CssUtil.addClass(notificationPane, "notif-warning");
        CssUtil.addClass(deleteNotifBtn, "notif-warning");
        notificationTitleLabel.setText("ATTENTION");
        break;
    case MessageEvent.ERROR:
        CssUtil.addClass(notificationPane, "notif-error");
        CssUtil.addClass(deleteNotifBtn, "notif-error");
        notificationTitleLabel.setText("ERREUR");
        timeDisplayed = 0.0;
        break;
    }
    notificationPane.setManaged(true);
    notificationPane.setVisible(true);

    if (timeDisplayed > 0.0) {
        FadeTransition ft = new FadeTransition(Duration.millis(150), notificationPane);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.play();
        Timeline timeline = new Timeline();
        timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(timeDisplayed), (ActionEvent event) -> {
            FadeTransition ft2 = new FadeTransition(Duration.millis(150), notificationPane);
            ft2.setFromValue(1.0);
            ft2.setToValue(0.0);
            ft2.setCycleCount(1);
            ft2.play();
            ft2.setOnFinished((ActionEvent event1) -> {
                notificationPane.setManaged(false);
                notificationPane.setVisible(false);
            });

        }));
        timeline.play();
    }
}

From source file:ubicrypt.ui.ctrl.HomeController.java

@PostConstruct
public void init() {
    gProgress = new GeneralProgress(inProgress, inProgressMessage);
    treeView.setCellFactory(treeView1 -> new TreeCellFactory(treeView1, fileUntracker, appEvents, gProgress));
    addProvider.setOnMouseClicked(event -> ctx.browse("selectProvider"));
    addFile.setOnMouseClicked(event -> {
        if (!localConfig.getProviders().stream().findAny().isPresent()) {
            ctx.browse("selectProvider");
            return;
        }//w w  w. j  a v a 2s .c o  m
        fileAdder.accept(emptyPath);
    });
    settings.setOnMouseClicked(event -> ctx.browse("settings"));
    filesRoot = new TreeItem<>(new RootFilesItem(event -> fileAdder.accept(emptyPath)));
    TreeItem<ITreeItem> root = new TreeItem<>();
    treeView.setRoot(root);

    root.getChildren().add(filesRoot);
    treeView.setShowRoot(false);
    localConfig.getLocalFiles().stream().filter(Utils.ignoredFiles)
            .forEach(localFile -> addFiles(localFile.getPath().iterator(), basePath, filesRoot, localFile));

    //providers
    providersRoot = new TreeItem<>(new RootProvidersItem());
    root.getChildren().add(providersRoot);
    localConfig.getProviders().stream().forEach(providerAdder);

    //provider status events
    providerEvent.subscribe(pevent -> {
        switch (pevent.getEvent()) {
        case added:
            log.info("new provider added:{}", pevent.getHook().getProvider());
            final Optional<TreeItem<ITreeItem>> optItem = providersRoot.getChildren().stream()
                    .filter(item -> ((ProviderItem) item.getValue()).getProvider()
                            .equals(pevent.getHook().getProvider()))
                    .findFirst();
            if (!optItem.isPresent()) {
                providerAdder.accept(pevent.getHook().getProvider());
            }
            pevent.getHook().getStatusEvents().subscribe(event -> {
                Function<String, String> classLabel;
                log.info("provider status {}:{}", event, pevent.getHook().getProvider());
                switch (event) {
                case error:
                    classLabel = code -> format("tree-provider-%s-error", code);
                    break;
                default:
                    //TODO:labels for other statuses
                    classLabel = code -> format("tree-provider-%s", code);
                }
                optItem.ifPresent(item -> {
                    final ProviderItem providerItem = (ProviderItem) item.getValue();
                    final Node graphics = providerItem.getGraphics();
                    graphics.getStyleClass().clear();
                    providerDescriptors.stream()
                            .filter(pd -> pd.getType().equals(providerItem.getProvider().getClass()))
                            .map(ProviderDescriptor::getCode).findFirst()
                            .ifPresent(code -> graphics.getStyleClass().add(classLabel.apply(code)));
                });
            });
            break;
        case removed:
            //TODO: remove provider
            break;
        default:
            log.warn("unmanaged event:{}", pevent.getEvent());
        }
    });

    //remote file events
    fileEvents.filter(fileEvent -> fileEvent.getLocation() == FileEvent.Location.remote)
            .subscribe(fileEvent -> {
                log.debug("file remote event:{}", fileEvent);
                //update file icon
                final UbiFile<UbiFile> file = fileEvent.getFile();
                Observable.create(fileInSync.call(file)).subscribe(res -> {
                    searchFile(filesRoot, file).ifPresent(treeView -> {
                        final Node graphics = treeView.getValue().getGraphics();
                        graphics.getStyleClass().clear();
                        graphics.getStyleClass().add(format("tree-file-saved-%s", res));
                    });
                });
            });
    //local file events
    fileEvents.filter(fileEvent -> fileEvent.getLocation() == FileEvent.Location.local
            && fileEvent.getType() == FileEvent.Type.created).subscribe(fileEvent -> {
                log.debug("file local event:{}", fileEvent);
                localConfig.getLocalFiles().stream().filter(fileEvent.getFile()::equals).findFirst().ifPresent(
                        fe -> addFiles(fileEvent.getFile().getPath().iterator(), basePath, filesRoot, fe));
                searchFile(filesRoot, fileEvent.getFile()).ifPresent(treeView -> {
                    final Node graphics = treeView.getValue().getGraphics();
                    graphics.getStyleClass().clear();
                    graphics.getStyleClass().add(format("tree-file-saved-%s", true));
                });
            });

    //file progress monitor
    progressEvents.subscribe(progress -> {
        Platform.runLater(() -> {
            if (progress.isCompleted()) {
                log.debug("progress completed");
                if (!filesInProgress.remove(progress)) {
                    log.warn("progress not tracked. progress file:{}, element:{}",
                            progress.getProvenience().getFile());
                }
                Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(2), ae -> {
                    progressFile.setText("");
                    progressProvider.setText("");
                    progressBar.setProgress(0D);
                }));
                timeline.play();
            } else {
                filesInProgress.add(progress);
            }
            if (filesInProgress.isEmpty()) {
                //                    footer.setVisible(false);
                return;
            }
            footer.setVisible(true);
            filesInProgress.stream().findFirst().ifPresent(pr -> {
                progressFile.setText(StringUtils
                        .abbreviate(pr.getProvenience().getFile().getPath().getFileName().toString(), 30));
                progressProvider.setText(StringUtils.abbreviate(pr.getTarget().toString(), 30));
                progressBar.setProgress((double) progress.getChunk() / pr.getProvenience().getFile().getSize());
            });
        });
    });

    //sync-done events
    appEvents.subscribe(ClassMatcher.newMatcher().on(SyncBeginEvent.class, event -> {
        log.info("sync begin received");
        Platform.runLater(() -> {
            gProgress.startProgress("Synchronizing providers");
            addFile.setDisable(true);
            addProvider.setDisable(true);
        });
    }).on(SynchDoneEvent.class, event -> {
        log.debug("sync done");
        refreshItems(filesRoot);
        Platform.runLater(() -> {
            gProgress.stopProgress();
            addFile.setDisable(false);
            addProvider.setDisable(false);
        });
    }));
}

From source file:com.QuarkLabs.BTCeClientJavaFX.MainController.java

@FXML
void initialize() {
    assert clearLogButton != null : "fx:id=\"clearLogButton\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert fundsTable != null : "fx:id=\"fundsTable\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert logField != null : "fx:id=\"logField\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert buyButton != null : "fx:id=\"buyButton\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert sellButton != null : "fx:id=\"sellButton\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert showActiveOrdersButton != null : "fx:id=\"showActiveOrdersButton\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTableLastColumn != null : "fx:id=\"tickerTableLastColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTablePairColumn != null : "fx:id=\"tickerTablePairColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTable != null : "fx:id=\"tickersTable\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTableBuyColumn != null : "fx:id=\"tickersTableBuyColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTableFeeColumn != null : "fx:id=\"tickersTableFeeColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tickersTableSellColumn != null : "fx:id=\"tickersTableSellColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tradeAmountValue != null : "fx:id=\"tradeAmountValue\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tradePriceCurrencyType != null : "fx:id=\"tradeCurrencyPriceValue\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tradeCurrencyType != null : "fx:id=\"tradeCurrencyType\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert tradePriceValue != null : "fx:id=\"tradePriceValue\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert updateFundsButton != null : "fx:id=\"updateFundsButton\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert fundsTableCurrencyColumn != null : "fx:id=\"fundsTableCurrencyColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert fundsTableValueColumn != null : "fx:id=\"fundsTableValueColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersTable != null : "fx:id=\"fundsTableValueColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersAmountColumn != null : "fx:id=\"activeOrdersAmountColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersPairColumn != null : "fx:id=\"activeOrdersPairColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersRateColumn != null : "fx:id=\"activeOrdersRateColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersTimeColumn != null : "fx:id=\"activeOrdersTimeColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersTypeColumn != null : "fx:id=\"activeOrdersTypeColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";
    assert activeOrdersCancelColumn != null : "fx:id=\"activeOrdersCancelColumn\" was not injected: check your FXML file 'mainlayout.fxml'.";

    //Holder for all main API methods of exchange
    app = new App();

    //Loading configs
    loadExchangeConfig();/*from  ww w .  j av  a  2 s .co m*/

    //Populate choiceboxes at the trading section
    tradeCurrencyType.setItems(FXCollections.observableArrayList(currencies));
    tradeCurrencyType.setValue(currencies.get(0));
    tradePriceCurrencyType.setItems(FXCollections.observableArrayList(currencies));
    tradePriceCurrencyType.setValue(currencies.get(0));

    //Active Orders table
    activeOrdersAmountColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, Double>("amount"));
    activeOrdersPairColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, String>("pair"));
    activeOrdersRateColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, Double>("rate"));
    activeOrdersTimeColumn.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<ActiveOrder, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(
                        TableColumn.CellDataFeatures<ActiveOrder, String> activeOrderStringCellDataFeatures) {
                    ActiveOrder activeOrder = activeOrderStringCellDataFeatures.getValue();
                    DateFormat dateFormat = DateFormat.getDateTimeInstance();
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(activeOrder.getTimestamp() * 1000);
                    return new SimpleStringProperty(dateFormat.format(calendar.getTime()));
                }
            });
    activeOrdersTypeColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, String>("type"));
    activeOrdersTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    activeOrdersCancelColumn
            .setCellFactory(new Callback<TableColumn<ActiveOrder, Boolean>, TableCell<ActiveOrder, Boolean>>() {
                @Override
                public TableCell<ActiveOrder, Boolean> call(
                        TableColumn<ActiveOrder, Boolean> activeOrderBooleanTableColumn) {
                    return new ButtonCell<>(activeOrdersTable);
                }
            });
    activeOrdersCancelColumn.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<ActiveOrder, Boolean>, ObservableValue<Boolean>>() {
                @Override
                public ObservableValue<Boolean> call(
                        TableColumn.CellDataFeatures<ActiveOrder, Boolean> activeOrderBooleanCellDataFeatures) {
                    return new SimpleBooleanProperty(true);
                }
            });

    //Tickers Table
    MenuItem showOrdersBook = new MenuItem("Show Orders Book");
    MenuItem showPublicTrades = new MenuItem("Show Public Trades");

    ContextMenu contextMenu = new ContextMenu(showOrdersBook, showPublicTrades);

    tickersTable.setItems(tickers);
    tickersTable.setContextMenu(contextMenu);
    tickersTableBuyColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("buy"));
    tickersTableFeeColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("fee"));
    tickersTableSellColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("sell"));
    tickersTableLastColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("last"));
    tickersTablePairColumn.setCellValueFactory(new PropertyValueFactory<Ticker, String>("pair"));
    tickersTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tickersTable.setRowFactory(new Callback<TableView<Ticker>, TableRow<Ticker>>() {
        @Override
        public TableRow<Ticker> call(TableView<Ticker> tickerTableView) {
            return new TableRow<Ticker>() {
                @Override
                protected void updateItem(Ticker ticker, boolean b) {
                    super.updateItem(ticker, b);
                    if (!b) {
                        if (tickersData.containsKey(ticker.getPair())) {
                            if (ticker.getLast() < tickersData.get(ticker.getPair()).getLast()) {
                                setStyle("-fx-control-inner-background: rgba(186, 0, 0, 0.5);");
                            } else if (ticker.getLast() == tickersData.get(ticker.getPair()).getLast()) {
                                setStyle("-fx-control-inner-background: rgba(215, 193, 44, 0.5);");
                            } else {
                                setStyle("-fx-control-inner-background: rgba(0, 147, 0, 0.5);");
                            }
                        }
                    }
                }
            };
        }
    });

    //Menu item to show Orders Book
    showOrdersBook.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            Ticker selectedTicker = tickersTable.getSelectionModel().getSelectedItem();
            Parent root;
            try {
                FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(PATH_TO_ORDERS_BOOK_LAYOUT),
                        resources);
                root = (Parent) fxmlLoader.load();
                OrdersBookController ordersBookController = fxmlLoader.getController();
                ordersBookController.injectPair(selectedTicker.getPair());
                Stage stage = new Stage();
                stage.setTitle("Orders Book for " + selectedTicker.getPair().replace("_", "/").toUpperCase());
                stage.setScene(new Scene(root));
                stage.setResizable(false);
                stage.show();

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    //Menu item to show Public Trades
    showPublicTrades.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            Ticker selectedTicker = tickersTable.getSelectionModel().getSelectedItem();
            Parent root;
            try {
                FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(PATH_TO_TRADES_LAYOUT),
                        resources);
                root = (Parent) fxmlLoader.load();
                PublicTradesController publicTradesController = fxmlLoader.getController();
                publicTradesController.injectPair(selectedTicker.getPair());
                Stage stage = new Stage();
                stage.setTitle("Public Trades for " + selectedTicker.getPair().replace("_", "/").toUpperCase());
                stage.setScene(new Scene(root));
                stage.setResizable(false);
                stage.show();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

    //Funds Table
    fundsTableCurrencyColumn.setCellValueFactory(new PropertyValueFactory<Fund, String>("currency"));
    fundsTableValueColumn.setCellValueFactory(new PropertyValueFactory<Fund, Double>("value"));
    fundsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    fundsTable.setItems(fundsData);

    //Task to load tickers data from server
    final javafx.concurrent.Service loadTickersService = new javafx.concurrent.Service() {
        @Override
        protected Task createTask() {
            Task<JSONObject> loadTickers = new Task<JSONObject>() {
                @Override
                protected JSONObject call() throws Exception {
                    String[] pairsArray = new String[pairs.size()];
                    pairsArray = pairs.toArray(pairsArray);
                    return App.getPairInfo(pairsArray);
                }
            };

            loadTickers.setOnFailed(new EventHandler<WorkerStateEvent>() {
                @Override
                public void handle(WorkerStateEvent workerStateEvent) {
                    logField.appendText(workerStateEvent.getSource().getException().getMessage() + "\r\n");
                }
            });

            loadTickers.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
                @Override
                public void handle(WorkerStateEvent workerStateEvent) {
                    JSONObject jsonObject = (JSONObject) workerStateEvent.getSource().getValue();

                    //ugly hack to store old values
                    //dump old values to tickersData
                    //TODO think about better solution
                    if (tickers.size() != 0) {
                        for (Ticker x : tickers) {
                            tickersData.put(x.getPair(), x);
                        }
                    }
                    tickers.clear();
                    for (Iterator iterator = jsonObject.keys(); iterator.hasNext();) {
                        String key = (String) iterator.next();
                        JSONObject data = jsonObject.getJSONObject(key);
                        Ticker ticker = new Ticker();
                        ticker.setPair(key);
                        ticker.setUpdated(data.optLong("updated"));
                        ticker.setAvg(data.optDouble("avg"));
                        ticker.setBuy(data.optDouble("buy"));
                        ticker.setSell(data.optDouble("sell"));
                        ticker.setHigh(data.optDouble("high"));
                        ticker.setLast(data.optDouble("last"));
                        ticker.setLow(data.optDouble("low"));
                        ticker.setVol(data.optDouble("vol"));
                        ticker.setVolCur(data.optDouble("vol_cur"));
                        tickers.add(ticker);
                    }

                }
            });
            return loadTickers;
        }
    };

    //Update tickers every 15 seconds
    //TODO better solution is required
    Timeline timeline = new Timeline(new KeyFrame(Duration.ZERO, new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            loadTickersService.restart();
        }
    }), new KeyFrame(Duration.seconds(15)));
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.playFromStart();

}

From source file:com.github.vatbub.tictactoe.view.Main.java

public void updateCurrentPlayerLabel(boolean noAnimation, boolean setBlockedValueAfterAnimation) {
    Platform.runLater(() -> stage.setTitle(getWindowTitle()));
    if (board.getCurrentPlayer() != null) {
        if (!board.getCurrentPlayer().getLetter().equals(currentPlayerLabel.getText())) {
            if (noAnimation) {
                setCurrentPlayerValue();
            } else {
                guiAnimationQueue.submitWaitForUnlock(() -> {
                    guiAnimationQueue.setBlocked(true);

                    GaussianBlur blur = (GaussianBlur) currentPlayerLabel.getEffect();
                    if (blur == null) {
                        blur = new GaussianBlur(0);
                    }/* ww w . j  a v  a2  s . c o  m*/

                    Calendar changeLabelTextDate = Calendar.getInstance();
                    changeLabelTextDate.add(Calendar.MILLISECOND, (int) (animationSpeed * 1000));
                    runLaterTimer.schedule(new TimerTask() {
                        @Override
                        public void run() {
                            Platform.runLater(() -> setCurrentPlayerValue());
                        }
                    }, changeLabelTextDate.getTime());

                    currentPlayerLabel.setEffect(blur);
                    Timeline timeline = new Timeline();
                    KeyValue keyValue1 = new KeyValue(blur.radiusProperty(), 20);
                    KeyFrame keyFrame1 = new KeyFrame(Duration.seconds(animationSpeed), keyValue1);

                    KeyValue keyValue2 = new KeyValue(blur.radiusProperty(), 0);
                    KeyFrame keyFrame2 = new KeyFrame(Duration.seconds(2 * animationSpeed), keyValue2);

                    timeline.getKeyFrames().addAll(keyFrame1, keyFrame2);

                    timeline.setOnFinished((event) -> {
                        currentPlayerLabel.setEffect(null);
                        guiAnimationQueue.setBlocked(false);
                        setBlockedForInput(setBlockedValueAfterAnimation);
                    });

                    timeline.play();
                });
                return;
            }
        }
    }

    guiAnimationQueue.setBlocked(false);
    setBlockedForInput(setBlockedValueAfterAnimation);
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void showLooser(Board.WinnerInfo winnerInfo) {
    String looserName = board.getOpponent(winnerInfo.winningPlayer).getName();
    guiAnimationQueue.submitWaitForUnlock(() -> {
        ShakeTransition anim = new ShakeTransition(gamePane, null);
        anim.playFromStart();/* w  w  w .ja v a2  s . co  m*/

        Timeline timeline = new Timeline();

        Circle c1 = new Circle((452 / 600.0) * looserPane.getWidth(), (323 / 640.0) * looserPane.getHeight(),
                0);
        GaussianBlur circleBlur = new GaussianBlur(30);
        c1.setEffect(circleBlur);
        looseImage.setClip(c1);
        addWinLineOnLoose(winnerInfo);

        KeyValue keyValue1 = new KeyValue(c1.radiusProperty(), 0);
        KeyFrame keyFrame1 = new KeyFrame(Duration.millis(800), keyValue1);
        KeyValue keyValue2 = new KeyValue(c1.radiusProperty(), (500 / 640.0) * looserPane.getHeight());
        KeyFrame keyFrame2 = new KeyFrame(Duration.millis(900), keyValue2);

        timeline.getKeyFrames().addAll(keyFrame1, keyFrame2);

        looseMessage.setOpacity(0);
        looserText.setText(looserName + " lost :(");
        looserPane.setVisible(true);
        looserPane.setOpacity(1);

        timeline.setOnFinished((event) -> {
            looseImage.setClip(null);
            winLineGroup.setClip(null);
            blurGamePane();
            PauseTransition wait = new PauseTransition();
            wait.setDuration(Duration.seconds(1));
            wait.setOnFinished((event2) -> {
                FadeTransition looseMessageTransition = new FadeTransition();
                looseMessageTransition.setNode(looseMessage);
                looseMessageTransition.setFromValue(0);
                looseMessageTransition.setToValue(1);
                looseMessageTransition.setDuration(Duration.millis(500));
                looseMessageTransition.setAutoReverse(false);
                looseMessageTransition.play();
            });

            wait.play();
        });

        timeline.play();
    });

}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void addWinLineOnLoose(Board.WinnerInfo winnerInfo) {
    final double strokeWidth = 2;

    Line originLine = new Line(0, 0, 0, 0);
    winLineGroup.getChildren().add(originLine);

    WinLine winLine = new WinLine(winnerInfo);
    winLine.startArc.setFill(Color.TRANSPARENT);
    winLine.startArc.setStroke(Color.BLACK);
    winLine.startArc.setStrokeWidth(strokeWidth);
    winLine.endArc.setFill(Color.TRANSPARENT);
    winLine.endArc.setStroke(Color.BLACK);
    winLine.endArc.setStrokeWidth(strokeWidth);
    winLine.rightLine.setStrokeWidth(strokeWidth);
    winLine.leftLine.setStrokeWidth(strokeWidth);

    winLine.centerLine.setStrokeWidth(0);
    winLineGroup.getChildren().addAll(winLine.getAll());

    winLineGroup.setOpacity(0);/* w  w w .  j  a  v a  2  s  . co  m*/
    GaussianBlur blur = new GaussianBlur(7);
    winLineGroup.setEffect(blur);
    winLineGroup.setVisible(true);
    KeyValue keyValue1 = new KeyValue(winLineGroup.opacityProperty(), 0);
    KeyFrame keyFrame1 = new KeyFrame(Duration.millis(900), keyValue1);
    KeyValue keyValue2 = new KeyValue(winLineGroup.opacityProperty(), 1);
    KeyFrame keyFrame2 = new KeyFrame(Duration.millis(950), keyValue2);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().addAll(keyFrame1, keyFrame2);
    timeline.play();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void blurNode(Node node, double toValue, @SuppressWarnings("SameParameterValue") Runnable onFinish) {
    guiAnimationQueue.submit(() -> {/*www . j av  a2  s  .  com*/
        GaussianBlur blur = (GaussianBlur) node.getEffect();
        if (blur == null) {
            blur = new GaussianBlur(0);
            node.setEffect(blur);
        }
        node.setEffect(blur);
        Timeline timeline = new Timeline();
        KeyValue keyValue = new KeyValue(blur.radiusProperty(), toValue);
        KeyFrame keyFrame = new KeyFrame(Duration.seconds(animationSpeed), keyValue);
        timeline.getKeyFrames().add(keyFrame);

        timeline.setOnFinished((event) -> {
            if (toValue == 0) {
                node.setEffect(null);
            }
            if (onFinish != null) {
                onFinish.run();
            }
        });

        timeline.play();
    });
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void updateMenuHeight(boolean includeAILevelSlider) {
    double toHeight = 0;
    int effectiveChildCount = 0;
    for (Node child : menuSubBox.getChildren()) {
        if (child.isVisible() && child != aiLevelTitleLabel && child != aiLevelSlider
                && child != aiLevelLabelPane) {
            toHeight = toHeight + child.getBoundsInParent().getHeight();
            effectiveChildCount = effectiveChildCount + 1;
        }//  w  w w. j a v  a 2 s . com
    }

    if (includeAILevelSlider) {
        toHeight = toHeight + aiLevelLabelPane.getPrefHeight();
        toHeight = toHeight + aiLevelSlider.getPrefHeight();
        toHeight = toHeight + aiLevelTitleLabel.getPrefHeight();
        effectiveChildCount = effectiveChildCount + 3;
    }

    toHeight = toHeight + menuSubBox.getSpacing() * (effectiveChildCount - 1);

    if (updateMenuHeightTimeline != null && updateMenuHeightTimeline.getStatus() == Animation.Status.RUNNING) {
        updateMenuHeightTimeline.stop();
    }

    updateMenuHeightTimeline = new Timeline();
    KeyValue keyValue0 = new KeyValue(menuSubBox.prefHeightProperty(), toHeight, Interpolator.EASE_BOTH);
    KeyFrame keyFrame0 = new KeyFrame(Duration.seconds(animationSpeed), keyValue0);
    updateMenuHeightTimeline.getKeyFrames().add(keyFrame0);

    updateMenuHeightTimeline.play();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

public void updateOpponentsTurnHBox(boolean noAnimation, boolean isShown) {
    double destinationTranslate;
    double animationOffsetInSeconds = 0;
    if (!isShown) {
        destinationTranslate = opponentsTurnHBox.getHeight() + 3;
        double timeSinceLastShownInMillis = Calendar.getInstance().getTime().getTime()
                - opponentsTurnLabelLastShown.getTime().getTime();
        double timeSinceLastShownInSeconds = timeSinceLastShownInMillis / 1000;
        animationOffsetInSeconds = Math
                .max(opponentsTurnLabelShownForAtLeastSeconds - timeSinceLastShownInSeconds, 0);
    } else {//from   ww w.  j a v  a  2  s  .  c o m
        destinationTranslate = 0;
        String opponentsName;
        if (board.getCurrentPlayer() == null || board.getOpponent(board.getCurrentPlayer()) == null) {
            opponentsName = "Opponent";
        } else {
            Player player;
            if (board.getCurrentPlayer().getPlayerMode() == PlayerMode.localHuman) {
                player = board.getOpponent(board.getCurrentPlayer());
            } else {
                player = board.getCurrentPlayer();
            }
            opponentsName = player.getName();
        }
        opponentsTurnLabel.setText(opponentsName + "'s turn...");
    }

    if (noAnimation) {
        opponentsTurnHBox.setTranslateY(destinationTranslate);
    } else {
        KeyValue keyValue1 = new KeyValue(opponentsTurnHBox.translateYProperty(),
                opponentsTurnHBox.getTranslateY());
        KeyFrame keyFrame1 = new KeyFrame(Duration.seconds(animationOffsetInSeconds), keyValue1);

        KeyValue keyValue2 = new KeyValue(opponentsTurnHBox.translateYProperty(), destinationTranslate);
        KeyFrame keyFrame2 = new KeyFrame(Duration.seconds(animationSpeed + animationOffsetInSeconds),
                keyValue2);
        Timeline timeline = new Timeline(keyFrame1, keyFrame2);
        timeline.setOnFinished((event) -> {
            if (isShown) {
                opponentsTurnLabelLastShown = Calendar.getInstance();
            }
        });
        timeline.play();
    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param strLstPano//ww w.  ja  v a 2s.  c o  m
 * @param iNumPano
 * @return
 */
public static Pane paneAffichageHS(String strLstPano, int iNumPano) {

    Pane paneHotSpots = new Pane();
    paneHotSpots.setTranslateY(10);
    paneHotSpots.setTranslateX(10);
    VBox vbHotspots = new VBox(5);
    paneHotSpots.getChildren().add(vbHotspots);
    Label lblPoint;
    int io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspots(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHS = new VBox();
        double deplacement = 0;
        vbPanneauHS.setLayoutX(deplacement);
        Pane paneHsPanoramique = new Pane(vbPanneauHS);
        paneHsPanoramique.setPrefHeight(300);
        paneHsPanoramique.setMinHeight(300);
        paneHsPanoramique.setMaxHeight(300);

        int iNum1 = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                if (c1.getFill() == Color.RED) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.RED);
                } else {
                    c1.setFill(Color.RED);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsPanoramique.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsPanoramique.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                c1.setFill(Color.YELLOW);
                c1.setStroke(Color.RED);
            }
        });
        paneHsPanoramique
                .setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsPanoramique.setId("HS" + io);
        lblPoint = new Label("Point #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setTranslateX(-deplacement);
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHotspots = new Separator(Orientation.HORIZONTAL);
        sepHotspots.setTranslateX(-deplacement);
        sepHotspots.setPrefWidth(321);
        sepHotspots.setTranslateX(2);
        paneHsPanoramique.setPrefWidth(325);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHotspots);
        if (strLstPano != null) {

            Label lblLien = new Label(rbLocalisation.getString("main.panoramiqueDestination"));
            lblLien.setTranslateX(10);
            ComboBox cbDestPano = new ComboBox();
            String[] strListe = strLstPano.split(";");
            cbDestPano.getItems().addAll(Arrays.asList(strListe));
            int iNum11 = getPanoramiquesProjet()[iNumPano].getHotspot(io).getNumeroPano();
            cbDestPano.setTranslateX(10);
            cbDestPano.setId("cbpano" + io);
            cbDestPano.getSelectionModel().select(iNum11);
            cbDestPano.getSelectionModel().selectedIndexProperty().addListener((ov, t, t1) -> {
                valideHS();
                if (dejaCharge) {
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });
            if (iNum11 != -1) {
                int iNumPan = iNum11;
                ImageView ivAfficheVignettePano = new ImageView(
                        getPanoramiquesProjet()[iNum11].getImgPanoRect());
                ivAfficheVignettePano.setPreserveRatio(true);
                ivAfficheVignettePano.setFitWidth(300);
                ivAfficheVignettePano.setLayoutY(10);
                ivAfficheVignettePano.setCursor(Cursor.HAND);
                ivAfficheVignettePano.setOnMouseClicked((e) -> {
                    affichePanoChoisit(iNumPan);
                });
                AnchorPane apVisuVignettePano = new AnchorPane(ivAfficheVignettePano);
                apVisuVignettePano.setPrefHeight(170);
                apVisuVignettePano.setTranslateX(10);
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, apVisuVignettePano, lblSep);
            } else {
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, lblSep);
            }

        }
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHS" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        vbHotspots.getChildren().addAll(paneHsPanoramique, lblSep);
    }
    int iNbHS = io;
    int iTaillePane = io * 325;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotImage(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHsImage = new VBox();
        Pane paneHsImage = new Pane(vbPanneauHsImage);
        int iNum = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {
                if (c1.getFill() == Color.BLUE) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.BLUE);
                } else {
                    c1.setFill(Color.BLUE);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsImage.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsImage.setOnMouseExited((e) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {

                c1.setFill(Color.BLUE);
                c1.setStroke(Color.YELLOW);
            }
            timBouge.pause();
        });
        paneHsImage.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsImage.setId("HSImg" + io);
        lblPoint = new Label("Image #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);

        paneHsImage.setPrefWidth(325);
        vbPanneauHsImage.getChildren().addAll(lblPoint, sepHS);
        Label lblLien = new Label(rbLocalisation.getString("main.imageChoisie"));
        lblLien.setTranslateX(10);

        String strF1XML = getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrLienImg();
        Image imgChoisie = new Image(
                "file:" + getStrRepertTemp() + File.separator + "images" + File.separator + strF1XML);
        ImageView ivChoisie = new ImageView(imgChoisie);
        ivChoisie.setTranslateX(100);
        ivChoisie.setFitWidth(100);
        ivChoisie.setFitHeight(imgChoisie.getHeight() / imgChoisie.getWidth() * 100);

        vbPanneauHsImage.getChildren().addAll(lblLien, ivChoisie, lblSep);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);

        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSImage" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHsImage.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        Label lblCoulFond = new Label(rbLocalisation.getString("diapo.couleurFond"));
        lblCoulFond.setTranslateX(10);
        Label lblOpacite = new Label(rbLocalisation.getString("diapo.opacite"));
        lblOpacite.setTranslateX(10);
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond().equals("")) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io).setStrCouleurFond(
                    "#" + getGestionnaireInterface().getCouleurFondTheme().toString().substring(2, 8));
        }
        ColorPicker cpCouleurFond = new ColorPicker(
                Color.valueOf(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond()));
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite() == -1) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io)
                    .setOpacite(getGestionnaireInterface().getOpaciteTheme());
        }
        cpCouleurFond.setTranslateX(100);
        int i = io;
        cpCouleurFond.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i)
                    .setStrCouleurFond("#" + cpCouleurFond.getValue().toString().substring(2, 8));
        });
        Slider slOpacite = new Slider(0, 1, getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite());
        slOpacite.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i).setOpacite(slOpacite.getValue());
        });
        slOpacite.setTranslateX(100);
        slOpacite.setPrefWidth(130);
        slOpacite.setMinWidth(130);
        slOpacite.setMaxWidth(130);
        vbPanneauHsImage.getChildren().addAll(lblCoulFond, cpCouleurFond, lblOpacite, slOpacite);

        vbHotspots.getChildren().addAll(paneHsImage, lblSep);
        iTaillePane += 225 + ivChoisie.getFitHeight();
        paneHsImage.setPrefHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMinHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMaxHeight(200 + ivChoisie.getFitHeight());
    }

    iNbHS += io;

    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotHTML(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsHtml = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.DARKGREEN) {
                    c1.setFill(Color.YELLOWGREEN);
                    c1.setStroke(Color.DARKGREEN);
                } else {
                    c1.setFill(Color.DARKGREEN);
                    c1.setStroke(Color.YELLOWGREEN);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsHtml.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsHtml.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.DARKGREEN);
                c1.setStroke(Color.YELLOWGREEN);
            }
        });
        paneHsHtml.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsHtml.setId("HSHTML" + io);
        lblPoint = new Label("Hotspot HTML #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsHtml.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSHTML" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        Button btnEditeHSHTML = new Button(rbLocalisation.getString("main.editeHTML"));
        btnEditeHSHTML.setPrefWidth(80);
        btnEditeHSHTML.setTranslateX(paneHsHtml.getPrefWidth() - btnEditeHSHTML.getPrefWidth() - 10);
        vbPanneauHS.getChildren().addAll(btnEditeHSHTML);
        btnEditeHSHTML.setOnAction((e) -> {
            EditeurHTML editHTML = new EditeurHTML();
            HotspotHTML HS = getPanoramiquesProjet()[iNumPano].getHotspotHTML(iNum);
            editHTML.setHsHTML(HS);
            Rectangle2D tailleEcran = Screen.getPrimary().getBounds();
            int iHauteur = (int) tailleEcran.getHeight() - 100;
            int iLargeur = (int) tailleEcran.getWidth() - 100;
            editHTML.affiche(iLargeur, iHauteur);
            editHTML.addPropertyChangeListener("bValide", (ev) -> {
                if (ev.getNewValue().toString().equals("true")) {
                    getPanoramiquesProjet()[iNumPano].setHotspotHTML(editHTML.getHsHTML(), iNum);
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });

        });

        vbHotspots.getChildren().addAll(paneHsHtml, lblSep);
        paneHsHtml.setPrefHeight(120);
        paneHsHtml.setMinHeight(120);
        paneHsHtml.setMaxHeight(120);
        iTaillePane += 145;
    }
    iNbHS += io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getiNombreHotspotDiapo(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsDiapo = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#dia" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.TURQUOISE) {
                    c1.setFill(Color.ORANGE);
                    c1.setStroke(Color.TURQUOISE);
                } else {
                    c1.setFill(Color.TURQUOISE);
                    c1.setStroke(Color.ORANGE);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsDiapo.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsDiapo.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.TURQUOISE);
                c1.setStroke(Color.ORANGE);
            }
        });
        paneHsDiapo.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsDiapo.setId("DIAPO" + io);
        lblPoint = new Label("Hotspot Diaporama #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsDiapo.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtDIA" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        ComboBox cbListeDiapo = new ComboBox();
        for (int i = 0; i < getiNombreDiapo(); i++) {
            cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama());
        }
        cbListeDiapo.getSelectionModel()
                .select(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getiNumDiapo());
        int iii = io;
        cbListeDiapo.getSelectionModel().selectedIndexProperty().addListener((ov, av, nv) -> {
            getPanoramiquesProjet()[iNumPano].getHotspotDiapo(iii).setiNumDiapo((int) nv);
        });
        cbListeDiapo.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(cbListeDiapo);
        //Ajouter Liste Diaporamas
        vbHotspots.getChildren().addAll(paneHsDiapo, lblSep);
        paneHsDiapo.setPrefHeight(120);
        paneHsDiapo.setMinHeight(120);
        paneHsDiapo.setMaxHeight(120);
        iTaillePane += 145;
    }
    valideHS();
    iNbHS += io;
    dejaCharge = true;
    paneHotSpots.setPrefHeight(iTaillePane);
    paneHotSpots.setMinHeight(iTaillePane);
    paneHotSpots.setMaxHeight(iTaillePane);
    paneHotSpots.setId("labels");
    apVisuHS.setPrefHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMinHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMaxHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setPrefHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMinHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMaxHeight(paneHotSpots.getPrefHeight());

    return paneHotSpots;
}