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:Main.java

private EventHandler<ActionEvent> changeTabPlacement() {
    return new EventHandler<ActionEvent>() {

        public void handle(ActionEvent event) {
            MenuItem mItem = (MenuItem) event.getSource();
            String side = mItem.getText();
            if ("left".equalsIgnoreCase(side)) {
                System.out.println("left");
            } else if ("right".equalsIgnoreCase(side)) {
                System.out.println("right");
            } else if ("top".equalsIgnoreCase(side)) {
                System.out.println("top");
            } else if ("bottom".equalsIgnoreCase(side)) {
                System.out.println("bottom");
            }/*from w w w.j  av  a  2  s.com*/
        }
    };
}

From source file:ninja.javafx.smartcsv.fx.about.AboutController.java

@FXML
public void openLinkInBrowser(ActionEvent actionEvent) {
    Hyperlink hyperlink = (Hyperlink) actionEvent.getSource();
    hostServices.showDocument(hyperlink.getText());
}

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

public void agree(ActionEvent event) {
    CheckBox chk = (CheckBox) event.getSource();
    if (chk.isSelected()) {
        submit.setDisable(false);//from  w w  w .j  a v a 2s  .c o  m
    } else {
        submit.setDisable(true);
    }
}

From source file:pe.gob.sunat.tecnologia3.arquitectura.framework.desktop.jfxrt.login.LoginController.java

private void ocultarLogin(ActionEvent event) {
    ((Node) event.getSource()).getScene().getWindow().hide();
    //        LoginForm.getInstance().setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //        LoginForm.getInstance().dispose();
}

From source file:UIController.java

@FXML
public void resetButton(ActionEvent event) {
    Object obj = event.getSource();
    if (obj instanceof Button) {
        Button clickedButton = (Button) obj;
        if (clickedButton.getId().equals("reset01")) {
            System.out.println("Reset button of Section 1 was clicked.");
            if (appID != null) {
                appID.setText(null);/*  w ww.j  av  a2  s.c  o  m*/
            }
            if (accessToken != null) {
                accessToken.setText(null);
            }
            if (mobileNumber != null) {
                mobileNumber.setText(null);
            }
        }
        if (clickedButton.getId().equals("reset02")) {
            System.out.println("Reset button of Section 2 was clicked.");
            if (otp != null) {
                otp.setText(otpStart);
            }
        }
    }
}

From source file:UIController.java

@FXML
public void submitButton(ActionEvent event) throws IOException, JSONException, Exception {
    Object obj = event.getSource();
    if (obj instanceof Button) {
        Button clickedButton = (Button) obj;
        if (clickedButton.getId().equals("submit01")) {
            System.out.println("Submit 01 Button Pressed.");
            cog.setAppID((String) appID.getText());
            cog.setAccessToken((String) accessToken.getText());
            statusText.setText("Processing...");
            String getCallStatus = cog.recieveOtp(mobileNumber.getText());
            if (getCallStatus.equalsIgnoreCase("success")) {
                statusText.setText("Missed call placed, enter otp...");
            } else {
                statusText.setText(getCallStatus);
            }//  w w  w .  j a  v  a 2  s.  c o  m
            otpStart = cog.otpStart;
            System.out.println(cog.statusMissedCall);
            otp.setText(otpStart);
        }
        if (clickedButton.getId().equals("submit02")) {
            System.out.println("Submit 02 Button Pressed.");
            String correctedOtp = otp.getText().replaceAll("[+]", "");
            System.out.println(correctedOtp);
            String status;
            status = cog.sendOtp((String) otp.getText());
            System.out.println(status);
            if (status.equalsIgnoreCase("success")) {
                statusText.setText("Mobile Number Verified SuccessFully");
            } else {
                statusText.setText("Mobile Number Verification Failed");
            }

        }
    }
}

From source file:jasperreports.FXMLDocumentController.java

@FXML
public void handleButtonAction(ActionEvent event) {

    Button b = (Button) event.getSource();
    if (destination.getText().length() > 0) {
        String destinationFileName = destination.getText();

        switch (b.getId()) {
        case "toPDF1":
            Generowanieraportow.generowanieraportu1pdf(destinationFileName);
            break;
        case "toHTML1":
            Generowanieraportow.generowanieraportu1html(destinationFileName);
            break;
        case "toPDF2":
            Generowanieraportow.generowanieraportu2pdf(destinationFileName);
            break;
        case "toHTML2":
            Generowanieraportow.generowanieraportu2html(destinationFileName);
            break;
        case "toPDF3":
            Generowanieraportow.generowanieraportu3pdf(destinationFileName);
            break;
        case "toHTML3":
            Generowanieraportow.generowanieraportu3html(destinationFileName);
            break;
        case "toPDF4":
            Generowanieraportow.generowanieraportu4pdf(destinationFileName);
            break;
        case "toHTML4":
            Generowanieraportow.generowanieraportu4html(destinationFileName);
            break;
        case "toPDF5":
            Generowanieraportow.generowanieraportu5pdf(destinationFileName);
            break;
        case "toHTML5":
            Generowanieraportow.generowanieraportu5html(destinationFileName);
            break;
        case "toPDF6":
            Generowanieraportow.generowanieraportu6pdf(destinationFileName);
            break;
        case "toHTML6":
            Generowanieraportow.generowanieraportu6html(destinationFileName);
            break;
        }/*from ww  w.j  a  v  a 2  s  . co m*/

    } else {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("Bd");
        alert.setHeaderText(null);
        alert.setContentText("Prosz wybra folder docelowy!");
        alert.showAndWait();
    }

}

From source file:webapptest.LogInScreenController.java

@FXML
public void logInPressed(ActionEvent event) throws IOException {
    int response = passwordVerification();

    if (response == 1) {
        Stage stageTheLabelBelongs = (Stage) ((Node) event.getSource()).getScene().getWindow();

        Parent webapp = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));

        Scene scene = new Scene(webapp);

        stageTheLabelBelongs.setScene(scene);
        stageTheLabelBelongs.show();//from ww w .j a  v a  2 s.com
    }
}

From source file:aajavafx.MedicinesController.java

@FXML
private void handleBackButton(ActionEvent event) {
    try {// w ww .  ja v  a  2 s .co  m

        Node node = (Node) event.getSource();
        Stage stage = (Stage) node.getScene().getWindow();

        FXMLLoader loader = new FXMLLoader(getClass().getResource("MainPage.fxml"));
        Parent root = loader.load();

        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.show();

        System.out.println("You clicked Schedule!");
    } catch (Exception ex) {

        System.out.println("ERROR! " + ex);
    }

}

From source file:memoryaid.GalleryController.java

/**
 * Initializes the controller class./*from w  ww .ja v a 2  s  . c  o m*/
 */
@FXML
private void handleUploadButtonAction(ActionEvent event) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Open Resource File");
    File selectedImage = fileChooser.showOpenDialog((Stage) ((Node) event.getSource()).getScene().getWindow());
    imagePathText.setText(selectedImage.getAbsolutePath());

}