Example usage for javafx.event ActionEvent getSource

List of usage examples for javafx.event ActionEvent getSource

Introduction

In this page you can find the example usage for javafx.event ActionEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:pe.edu.system.jcmr.util.UtilidadesFx.java

public void closeWindow(ActionEvent event) {

    Node source = (Node) event.getSource();
    Stage stage = (Stage) source.getScene().getWindow();
    stage.close();/* ww w  . j  a  v  a2  s . c  o  m*/

}

From source file:com.bdb.weather.display.day.DayTemperaturePane.java

@Override
public void handle(ActionEvent event) {
    super.handle(event);
    Object source = event.getSource();
    if (source == minMaxLabelsItem) {
        addAnnotations(getPlot(), summary);
    }/*w  ww .  j  a v  a 2  s .  c  o  m*/
}

From source file:benedict.zhang.addon.soundmanager.controller.SoundManagerConfigureController.java

public void onPlayPauseButtonClick(ActionEvent e) {
    Button btn = (Button) e.getSource();
    if ("Play".equals(btn.getText())) {
        this.mediaPlayer.play();
    } else if ("Pause".equals(btn.getText())) {
        this.mediaPlayer.pause();
    }//from   ww w. ja va  2s .c  o  m
}

From source file:memoryaid.GalleryController.java

@FXML
private void HandleGalleryLinkAction(ActionEvent event) throws IOException {
    System.out.println("You clicked me!");
    Parent Gallery = FXMLLoader.load(getClass().getResource("FamilySpecHome.fxml"));
    Scene Gallery_scene = new Scene(Gallery);
    Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
    app_stage.hide();/*from w w w.j  av a  2  s .c o  m*/
    app_stage.setScene(Gallery_scene);
    app_stage.show();
}

From source file:benedict.zhang.addon.soundmanager.controller.SoundManagerConfigureController.java

public void onEditUpdateButtonClick(ActionEvent e) {
    Button btn = (Button) e.getSource();
    if ("Edit".equals(btn.getText())) {
        this.setMode(UIViewMode.EDIT);
    } else {//update button clicked
        this.setMode(UIViewMode.READONLY);
        doUpdate();/*from ww  w  .j a va2 s. co  m*/
    }
    if ("Save".equals(btn.getText())) {
        doUpdate();
    }
}

From source file:com.bekwam.examples.javafx.oldscores.ScoresDialogController.java

@FXML
public void close(ActionEvent evt) {

    Scene scene = ((Button) evt.getSource()).getScene();
    if (scene != null) {
        Window w = scene.getWindow();
        if (w != null) {
            w.hide();/* w w w .  ja v a 2 s . c  o m*/
        }
    }
}

From source file:com.bekwam.resignator.NewPasswordController.java

@FXML
public void cancel(ActionEvent evt) {

    if (logger.isDebugEnabled()) {
        logger.debug("[CANCEL]");
    }/*from   w w  w  .ja va  2s .  c om*/

    reset();

    synchronized (this) {
        notify();
    }

    ((Button) evt.getSource()).getScene().getWindow().hide();
}

From source file:com.bekwam.resignator.PasswordController.java

@FXML
public void resetDataFile(ActionEvent evt) {

    if (logger.isDebugEnabled()) {
        logger.debug("[RESET DATA FILE]");
    }/*from   ww  w  . ja va  2s .  c o  m*/

    ((Hyperlink) evt.getSource()).getScene().getWindow().hide();

    ButtonType myCancel = new ButtonType("Just Exit", ButtonBar.ButtonData.CANCEL_CLOSE);

    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Delete all data and exit the app?", ButtonType.OK,
            myCancel);

    alert.setHeaderText("Delete all data");
    //alert.setOnCloseRequest((w_evt) -> Platform.exit());

    Optional<ButtonType> response = alert.showAndWait();

    if (!response.isPresent() || response.get() != ButtonType.OK) {
        if (logger.isDebugEnabled()) {
            logger.debug("[RESET DATA FILE] reset cancelled");
        }

        exitCode = ExitCodeType.CANCELLED;
        passwordMatches.setValue(false);

        synchronized (this) {
            this.notify();
        }

    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("[RESET DATA FILE] reset");
        }

        configurationDataSource.deleteDataFile();

        exitCode = ExitCodeType.RESET;
        passwordMatches.setValue(false);

        synchronized (this) {
            this.notify();
        }
    }
}

From source file:com.bekwam.resignator.PasswordController.java

@FXML
public void cancel(ActionEvent evt) {
    if (logger.isDebugEnabled()) {
        logger.debug("[CANCEL]");
    }/*from w  ww .jav  a2 s  .c  om*/

    exitCode = ExitCodeType.CANCELLED;
    passwordMatches.setValue(false);

    ((Button) evt.getSource()).getScene().getWindow().hide();

    synchronized (this) {
        this.notify();
    }
}

From source file:com.loop81.fxcomparer.FXComparerController.java

@FXML
protected void onSelectFile1(ActionEvent event) {
    event.consume();/*from w  ww .ja v  a2  s.  c  om*/
    archive1 = selectFile(((Node) event.getSource()).getScene().getWindow());
    handleFile(archive1, textFieldArchive1, labelArchive1Info);
}