Java Code Examples for javafx.animation.FadeTransition

The following examples show how to use javafx.animation.FadeTransition. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: constellation   Source File: TimelineChart.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void dataItemRemoved(final Data<Number, Number> item,
        final Series<Number, Number> series) {
    final Node child = item.getNode();

    if (shouldAnimate()) {
        // fade out old item:
        final FadeTransition ft = new FadeTransition(Duration.millis(500), child);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(final ActionEvent actionEvent) {
                getPlotChildren().remove(child);
            }
        });
        ft.play();
    } else {
        getPlotChildren().remove(child);
    }
}
 
Example 2
Source Project: constellation   Source File: TimelineChart.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void seriesRemoved(final Series<Number, Number> series) {

    final Node child = series.getNode();
    if (shouldAnimate()) {
        // fade out old item:
        final FadeTransition ft = new FadeTransition(Duration.millis(500), child);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(final ActionEvent actionEvent) {
                getPlotChildren().clear();
            }
        });
        ft.play();
    } else {
        getPlotChildren().clear();
    }
}
 
Example 3
Source Project: bisq   Source File: CandleStickChart.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    getPlotChildren().remove(candle);

    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top

    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        seriesPath.toFront();
    }
}
 
Example 4
Source Project: bisq   Source File: VolumeChart.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node volumeBar = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> getPlotChildren().remove(volumeBar));
            ft.play();
        } else {
            getPlotChildren().remove(volumeBar);
        }
    }
    if (shouldAnimate()) {
        new Timeline(new KeyFrame(Duration.millis(500), event -> removeSeriesFromDisplay(series))).play();
    } else {
        removeSeriesFromDisplay(series);
    }
}
 
Example 5
Source Project: Quelea   Source File: LoadingPane.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create the loading pane.
 */
public LoadingPane() {
    setAlignment(Pos.CENTER);
    VBox content = new VBox();
    content.setAlignment(Pos.CENTER);
    Text text = new Text(LabelGrabber.INSTANCE.getLabel("loading.text") + "...");
    text.setStyle(" -fx-font: bold italic 20pt \"Arial\";");
    FadeTransition textTransition = new FadeTransition(Duration.seconds(1.5), text);
    textTransition.setAutoReverse(true);
    textTransition.setFromValue(0);
    textTransition.setToValue(1);
    textTransition.setCycleCount(Transition.INDEFINITE);
    textTransition.play();
    content.getChildren().add(text);
    bar = new ProgressBar();
    content.getChildren().add(bar);
    getChildren().add(content);
    setOpacity(0);
    setStyle("-fx-background-color: #555555;");
    setVisible(false);
}
 
Example 6
Source Project: MyBox   Source File: GameElimniationController.java    License: Apache License 2.0 6 votes vote down vote up
protected void flush(int i, int j) {
    if (flushTimes < 1) {
        return;
    }
    try {
        FadeTransition fade = new FadeTransition(Duration.millis(flushDuration));
        fade.setFromValue(1.0);
        fade.setToValue(0f);
        fade.setCycleCount(flushTimes * 2);
        fade.setAutoReverse(true);
        fade.setNode(chessBoard.get(i + "-" + j));
        fade.play();
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
Example 7
Source Project: marathonv5   Source File: AdvCandleStickChartSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
Example 8
Source Project: marathonv5   Source File: AdvCandleStickChartSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemRemoved(Data<Number, Number> item, Series<Number, Number> series) {
    final Node candle = item.getNode();
    if (shouldAnimate()) {
        // fade out old candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {
                getPlotChildren().remove(candle);
            }
        });
        ft.play();
    } else {
        getPlotChildren().remove(candle);
    }
}
 
Example 9
Source Project: marathonv5   Source File: AdvCandleStickChartSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
Example 10
Source Project: marathonv5   Source File: AdvCandleStickChartSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
Example 11
Source Project: marathonv5   Source File: AdvCandleStickChartSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
Example 12
Source Project: charts   Source File: InfoPopup.java    License: Apache License 2.0 6 votes vote down vote up
private void init() {
    setAutoFix(true);
    rowCount = 2;

    fadeIn = new FadeTransition(Duration.millis(200), hBox);
    fadeIn.setFromValue(0);
    fadeIn.setToValue(0.75);

    fadeOut = new FadeTransition(Duration.millis(200), hBox);
    fadeOut.setFromValue(0.75);
    fadeOut.setToValue(0.0);
    fadeOut.setOnFinished(e -> hide());

    delay = new PauseTransition(Duration.millis(_timeout));
    delay.setOnFinished(e -> animatedHide());
}
 
Example 13
Source Project: bisq   Source File: VolumeChart.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) {
    final Node node = item.getNode();
    if (shouldAnimate()) {
        FadeTransition ft = new FadeTransition(Duration.millis(500), node);
        ft.setToValue(0);
        ft.setOnFinished((ActionEvent actionEvent) -> {
            getPlotChildren().remove(node);
            removeDataItemFromDisplay(series, item);
        });
        ft.play();
    } else {
        getPlotChildren().remove(node);
        removeDataItemFromDisplay(series, item);
    }
}
 
Example 14
Source Project: examples-javafx-repos1   Source File: Sprite.java    License: Apache License 2.0 6 votes vote down vote up
public void flagAsError() {
	
	this.normal.setVisible(true);  // hidden behind error
	this.highlight.setVisible(false);
	this.drag.setVisible(false);
	this.error.setVisible(true);
	
	FadeTransition ft = new FadeTransition(Duration.seconds(4), this.error);
    ft.setFromValue(1.0);
    ft.setToValue(0.0);
    ft.setOnFinished( (evt) -> {
    	
		this.normal.setVisible(true);  // show normal
		this.highlight.setVisible(false);
		this.drag.setVisible(false);
		this.error.setVisible(false);

    	this.error.setOpacity( 1.0d );  // restore opacity
    	
    });
    ft.play();
}
 
Example 15
Source Project: JFoenix   Source File: JFXBadge.java    License: Apache License 2.0 6 votes vote down vote up
public void refreshBadge() {
    badge.getChildren().clear();
    if (enabled) {


        Label labelControl = new Label(text.getValue());

        StackPane badgePane = new StackPane();
        badgePane.getStyleClass().add("badge-pane");
        badgePane.getChildren().add(labelControl);
        //Adding a clip would avoid overlap but this does not work as intended
        //badgePane.setClip(clip);
        badge.getChildren().add(badgePane);
        StackPane.setAlignment(badge, getPosition());

        FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
        ft.setFromValue(0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(true);
        ft.play();
    }
}
 
Example 16
Source Project: metastone   Source File: CardPlayedToken.java    License: GNU General Public License v2.0 6 votes vote down vote up
public CardPlayedToken(GameBoardView boardView, Card card) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);

	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
	animation.setDelay(Duration.seconds(0.6f));
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
}
 
Example 17
public RecordingListController(Archivo mainApp) {
    recordingSelection = new RecordingSelection();
    tivoIsBusy = new SimpleBooleanProperty(false);
    alreadyDefaultSorted = false;
    fadeTransition = new FadeTransition(javafx.util.Duration.millis(FADE_DURATION));
    this.mainApp = mainApp;
    tivos = FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
    tablePlaceholderMessage = new Label("No recordings are available");
    tivoSelectedListener = (tivoList, oldTivo, curTivo) -> {
        logger.info("New TiVo selected: {}", curTivo);
        if (curTivo != null) {
            mainApp.setLastDevice(curTivo);
            fetchRecordingsFrom(curTivo);
        }
    };
}
 
Example 18
Source Project: uip-pc2   Source File: Resumen.java    License: MIT License 6 votes vote down vote up
public void ver(ActionEvent actionEvent) {
    Stage stage = (Stage) movimientos.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Movimientos.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Movimientos controller = fxmlLoader.<Movimientos>getController();
    controller.cargar_movimientos(cuenta.getText());
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 19
Source Project: uip-pc2   Source File: Resumen.java    License: MIT License 6 votes vote down vote up
public void transferir(ActionEvent actionEvent) {
    Stage stage = (Stage) movimientos.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Transferencia.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Transferencia controller = fxmlLoader.<Transferencia>getController();
    controller.cargar_datos(cuenta.getText()); // ¯\_(ツ)_/¯ cuenta viene de la linea 27
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 20
Source Project: Enzo   Source File: RadialMenu.java    License: Apache License 2.0 6 votes vote down vote up
public void close() {
    if (State.CLOSED == getState()) return;

    setState(State.CLOSED);
    RotateTransition rotate = new RotateTransition();
    rotate.setNode(cross);
    rotate.setToAngle(0);
    rotate.setDuration(Duration.millis(200));
    rotate.setInterpolator(Interpolator.EASE_BOTH);
    rotate.play();
    closeTimeLines[closeTimeLines.length - 1].setOnFinished(actionEvent -> {
        FadeTransition buttonFadeOut = new FadeTransition();
        buttonFadeOut.setNode(mainMenuButton);
        buttonFadeOut.setDuration(Duration.millis(100));
        buttonFadeOut.setToValue(options.getButtonAlpha());
        buttonFadeOut.play();
        buttonFadeOut.setOnFinished(event -> {
            if (options.isButtonHideOnClose()) hide();
            fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_FINISHED));
        });
    });
    for (int i = 0 ; i < closeTimeLines.length ; i++) {
        closeTimeLines[i].play();
    }
    fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_STARTED));
}
 
Example 21
Source Project: uip-pc2   Source File: Transferencia.java    License: MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 22
Source Project: uip-pc2   Source File: Transferencia.java    License: MIT License 6 votes vote down vote up
public void atras(MouseEvent mouseEvent) {
    Stage stage = (Stage) atras.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Resumen.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Resumen controller = fxmlLoader.<Resumen>getController();
    controller.setCuenta();
    controller.setSaldo();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 23
Source Project: uip-pc2   Source File: Movimientos.java    License: MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 24
Source Project: uip-pc2   Source File: Controller2.java    License: MIT License 6 votes vote down vote up
public void salir(ActionEvent actionEvent) {
    Stage stage = (Stage) btn_salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("sample.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    //? controller = fxmlLoader.<?>getController();
    //controller.setConteo(conteo);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 25
Source Project: uip-pc2   Source File: Secundario.java    License: MIT License 6 votes vote down vote up
public void volver(ActionEvent actionEvent) {
    Stage stage = (Stage) btnvolver.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Principal.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Principal controller = fxmlLoader.<Principal>getController();
    controller.setConteo(conteo);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 26
Source Project: TweetwallFX   Source File: CloudFadeOutStep.java    License: MIT License 6 votes vote down vote up
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");

    List<Transition> fadeOutTransitions = new ArrayList<>();

    Duration defaultDuration = Duration.seconds(1.5);

    // kill the remaining words from the cloud
    wordleSkin.word2TextMap.entrySet().forEach(entry -> {
        Text textNode = entry.getValue();
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(0);
        ft.setOnFinished(event
                -> wordleSkin.getPane().getChildren().remove(textNode));
        fadeOutTransitions.add(ft);
    });
    wordleSkin.word2TextMap.clear();

    ParallelTransition fadeLOuts = new ParallelTransition();

    fadeLOuts.getChildren().addAll(fadeOutTransitions);
    fadeLOuts.setOnFinished(e -> context.proceed());
    fadeLOuts.play();
}
 
Example 27
Source Project: constellation   Source File: TimelineChart.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void seriesAdded(final Series<Number, Number> series, int seriesIndex) {
    // Handle any data already in series:
    for (int j = 0; j < series.getData().size(); j++) {
        final Data<Number, Number> item = series.getData().get(j);

        final Node prospective;
        if (item.getExtraValue() instanceof Interaction) {
            prospective = (Interaction) item.getExtraValue();
        } else {
            prospective = (Cluster) item.getExtraValue();
        }

        item.setNode(prospective);

        if (shouldAnimate()) {
            prospective.setOpacity(0);
            getPlotChildren().add(prospective);

            final FadeTransition ft = new FadeTransition(Duration.millis(500), prospective);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(prospective);
        }
    }
}
 
Example 28
Source Project: WorkbenchFX   Source File: GlassPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link GlassPane} object and fully initializes it.
 */
public GlassPane() {
  getStyleClass().add("glass-pane");

  setMouseTransparent(false);
  setVisible(false);

  hideProperty().addListener((observable, oldHide, newHide) -> {
    // don't do anything if the state hasn't changed
    if (oldHide.equals(newHide)) {
      return;
    }
    setVisible(true);

    FadeTransition fadeTransition = new FadeTransition();
    fadeTransition.setDuration(Duration.millis(200));
    fadeTransition.setNode(this);
    fadeTransition.setFromValue(this.isHide() ? .5 : 0);
    fadeTransition.setToValue(this.isHide() ? 0 : .5);
    fadeTransition.setOnFinished(evt -> {
      if (isHide()) {
        setVisible(false);
      }
    });
    fadeTransition.play();
  });
}
 
Example 29
Source Project: Quelea   Source File: ScheduleListNode.java    License: GNU General Public License v3.0 5 votes vote down vote up
public ScheduleListNode(Displayable displayable) {
    super(10);
    setAlignment(Pos.CENTER_LEFT);
    ImageView icon = displayable.getPreviewIcon();
    liveIcon = new ImageView(new Image("file:icons/recordingssettingsicon.png"));
    liveIcon.setFitHeight(10);
    liveIcon.setFitWidth(10);
    liveIcon.setVisible(false);
    getChildren().add(icon);
    getChildren().add(new Label(displayable.getPreviewText()));
    getChildren().add(liveIcon);

    if (displayable instanceof TextDisplayable || displayable instanceof TimerDisplayable) {
        themeButton = new Button("", new ImageView(new Image("file:icons/theme.png", 16, 16, false, true)));
        if (displayable instanceof TextDisplayable) {
            themeButton.setOnAction(new EditThemeScheduleActionHandler((TextDisplayable) displayable));
        } else {
            themeButton.setOnAction(new EditTimerThemeActionHandler((TimerDisplayable) displayable));
        }
        Utils.setToolbarButtonStyle(themeButton);
        Region spacer = new Region();
        HBox.setHgrow(spacer, Priority.ALWAYS);
        getChildren().add(spacer);
        getChildren().add(themeButton);
        themeButton.setOpacity(0);
        fade = new FadeTransition(Duration.millis(100), themeButton);
        setOnMouseEntered((event) -> {
            fade.stop();
            fade.setToValue(1);
            fade.play();
        });
        setOnMouseExited((event) -> {
            fade.stop();
            fade.setToValue(0);
            fade.play();
        });
    }
}
 
Example 30
Source Project: Quelea   Source File: SpellTextArea.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check the spelling on this text area - called internally to update state,
 * but can be fired externally also.
 * <p/>
 *
 * @param lastWord true if the last word should be included in the spell
 *                 check.
 */
public void updateSpelling(boolean lastWord) {
    spellingOkProperty.set(speller.checkText(getText(), lastWord));
    FadeTransition transition = new FadeTransition(Duration.seconds(0.2), warning);
    if (spellingOkProperty.get()) {
        transition.setFromValue(warning.getOpacity());
        transition.setToValue(0);
    } else {
        transition.setFromValue(warning.getOpacity());
        transition.setToValue(WARNING_OPACITY);
    }
    transition.play();
}