Search in sources :

Example 1 with Undo

use of system.Undo in project Money-Manager by krHasan.

the class TransactionHistoryController method mnuUndo.

@FXML
private void mnuUndo(ActionEvent event) {
    String feedback = new Undo().actionUndo();
    Stage TransactionHistoryStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("Action Successful");
    alert.setHeaderText(null);
    alert.setContentText(feedback);
    alert.setX(TransactionHistoryStage.getX() + 190);
    alert.setY(TransactionHistoryStage.getY() + 190);
    initialize();
    Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            alert.hide();
        }
    }));
    idlestage.setCycleCount(1);
    idlestage.play();
    alert.showAndWait();
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) Undo(system.Undo) FXML(javafx.fxml.FXML)

Example 2 with Undo

use of system.Undo in project Money-Manager by krHasan.

the class MakeATransactionController method mnuUndo.

@FXML
private void mnuUndo(ActionEvent event) {
    String feedback = new Undo().actionUndo();
    Stage MakeATransactionStage = (Stage) btnSignOut.getScene().getWindow();
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("Action Successful");
    alert.setHeaderText(null);
    alert.setContentText(feedback);
    alert.setX(MakeATransactionStage.getX() + 190);
    alert.setY(MakeATransactionStage.getY() + 29);
    // initialize();
    gmInitialize();
    exInitialize();
    leInitialize();
    bkInitialize();
    rocInitialize();
    perInitialize();
    Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            alert.hide();
        }
    }));
    idlestage.setCycleCount(1);
    idlestage.play();
    alert.showAndWait();
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) Undo(system.Undo) FXML(javafx.fxml.FXML)

Aggregations

KeyFrame (javafx.animation.KeyFrame)2 Timeline (javafx.animation.Timeline)2 ActionEvent (javafx.event.ActionEvent)2 EventHandler (javafx.event.EventHandler)2 FXML (javafx.fxml.FXML)2 Alert (javafx.scene.control.Alert)2 Stage (javafx.stage.Stage)2 Undo (system.Undo)2