當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionEvent.getSource方法代碼示例

本文整理匯總了Java中javafx.event.ActionEvent.getSource方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionEvent.getSource方法的具體用法?Java ActionEvent.getSource怎麽用?Java ActionEvent.getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.event.ActionEvent的用法示例。


在下文中一共展示了ActionEvent.getSource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleButtonAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
protected void handleButtonAction(ActionEvent event) {
    if (event.getSource() instanceof Button) {
        Button button = (Button) event.getSource();
        if (button.equals(addPattern)) {
            addPattern();
        } else if (button.equals(removePattern)) {
            removePattern();
        } else if (button.equals(addPath)) {
            addPath();
        } else if (button.equals(removePath)) {
            removePath();
        } else if (button.equals(findFiles)) {
            findFiles();
        }
    }
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:18,代碼來源:FXMLController.java

示例2: openSubmit2

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openSubmit2(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit2.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:submitController.java

示例3: onSaveAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
/**
 * When the user saves the bookmark.
 * <p>
 * Hides the owner {@link javafx.stage.Window} afterwards.
 *
 * @param actionEvent the {@link ActionEvent}
 */
@FXML
void onSaveAction(final ActionEvent actionEvent) {
    if (graphVisualizer.getSelectedSegmentProperty().isNull().get()) {
        return;
    }

    final String baseString = baseOffset.getText().replaceAll("[^\\d]", "");
    final String radiusString = radius.getText().replaceAll("[^\\d]", "");

    if (!baseString.isEmpty() && !radiusString.isEmpty()) {
        final GfaNode gfaNode = graphVisualizer.getSelectedSegmentProperty().get();
        final Segment segment = gfaNode.getSegments().get(0);
        final int baseOffsetValue = Integer.parseInt(baseString);
        final int radiusValue = Integer.parseInt(radiusString);

        bookmarkStore.addBookmark(new Bookmark(segment.getId(), baseOffsetValue, radiusValue,
                description.getText()));
        description.clear();

        final Node source = (Node) actionEvent.getSource();
        source.getScene().getWindow().hide();
    }

    actionEvent.consume();
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:33,代碼來源:BookmarkCreateController.java

示例4: okAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
/**
 * The action to fire when the user clicks the "Ok" button.
 * <p>
 * Sets the mapped genome in {@link GraphAnnotation} to the value in the genome choice textfield.
 *
 * @param actionEvent the {@link ActionEvent}
 */
@FXML
void okAction(final ActionEvent actionEvent) {
    if (genomeChoice.getText().isEmpty()) {
        (new WarningDialogue("Please select a mapping.")).show();
        return;
    }

    try {
        graphAnnotation.setMappedGenome(genomeChoice.getText());
    } catch (final IOException e) {
        LOGGER.error("Unable to build an index for genome " + genomeChoice.getText() + ".", e);
        new ErrorDialogue(e).show();
    }

    final Node source = (Node) actionEvent.getSource();
    source.getScene().getWindow().hide();

    actionEvent.consume();

    LOGGER.info("Genome " + gffGenome.getText() + " from GFF will be mapped onto " + genomeChoice.getText() + ".");
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:29,代碼來源:GenomeMappingController.java

示例5: openContact

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openContact(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Contact.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:homepageController.java

示例6: openHome

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openHome(ActionEvent event) throws IOException {
    MyJDBC.createTestDatabase("shabo");
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:23,代碼來源:contactController.java

示例7: openCreditsAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openCreditsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Credits.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:homepageController.java

示例8: openFAQ

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openFAQ(final ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent root = FXMLLoader.load(getClass().getResource("/fxml/FAQ.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:contactController.java

示例9: openStatisticsAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openStatisticsAction(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Statistics.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();

    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.setScene(hScene);
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:homepageController.java

示例10: onAddBill

import javafx.event.ActionEvent; //導入方法依賴的package包/類
public void onAddBill(ActionEvent actionEvent) {
    Node source = (Node) actionEvent.getSource();
    Stage currentStage = (Stage) source.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../../Resources/Layouts/alert_stage.fxml"));

    addEntry(currentStage, fxmlLoader);
}
 
開發者ID:alchemsynergy,項目名稱:alchem,代碼行數:8,代碼來源:AddSaleController.java

示例11: createSchedule

import javafx.event.ActionEvent; //導入方法依賴的package包/類
public void createSchedule(ActionEvent actionEvent) throws IOException {
        final FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Conference YAML info");
        fileChooser.getExtensionFilters()
                .addAll(
                        new FileChooser.ExtensionFilter("yml", "*.yml")
                );
        Node source = (Node) actionEvent.getSource();
        File file = fileChooser.showOpenDialog(source.getScene().getWindow());
        if (file == null) {
            return;
        }

        Stage dialog = new Stage();
//        dialog.initModality(Modality.WINDOW_MODAL);

        URL resource = getClass().getResource("schedule.fxml");
        FXMLLoader loader = new FXMLLoader(resource);
        Parent root = loader.load();

        ScheduleController schedule = loader.getController();
        schedule.setYml(file);

        dialog.setScene(new Scene(root, 800, 600));
        dialog.setTitle(file.getName() + ", " + file.getParentFile().getAbsolutePath());
        dialog.show();
    }
 
開發者ID:vlsi,項目名稱:confplanner,代碼行數:28,代碼來源:MainController.java

示例12: openSubmitPopUp

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@FXML
public void openSubmitPopUp(ActionEvent event) throws IOException {
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/submitPopUp.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:12,代碼來源:submitController.java

示例13: showLegendButtonClicked

import javafx.event.ActionEvent; //導入方法依賴的package包/類
private void showLegendButtonClicked(ActionEvent event) {
	ImageToggleButton source = (ImageToggleButton) event.getSource();
	if (source.isSelected()) {
		latestConfig.setLegendInsidePlot(true);
	} else {
		latestConfig.setLegendInsidePlot(false);
	}
	dataviewer.updateConfiguration(latestConfig);
}
 
開發者ID:jasrodis,項目名稱:javafx-dataviewer,代碼行數:10,代碼來源:TopMenu.java

示例14: handlePresentationMode

import javafx.event.ActionEvent; //導入方法依賴的package包/類
@Override
public void handlePresentationMode(ActionEvent event) {
    if (event.getSource() instanceof RadioMenuItem) {
        RadioMenuItem rmi = (RadioMenuItem) event.getSource();
        if (rmi.isSelected()) {
            if (!mainScene.getRoot().getStyleClass().contains("presentation")) {
                mainScene.getRoot().getStyleClass().add("presentation");
            }
        } else {
            mainScene.getRoot().getStyleClass().remove("presentation");
        }
    }
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:14,代碼來源:MainHandler.java

示例15: onDataUpdateAction

import javafx.event.ActionEvent; //導入方法依賴的package包/類
private EventHandler<ActionEvent> onDataUpdateAction(TatMain app, FinancialMarket fm, TatConfig config) {
return new EventHandler<ActionEvent>() {
    public void handle(ActionEvent event) {
        MenuItem mItem = (MenuItem) event.getSource();
        String cmdString = mItem.getText();
        if(cmdString.equalsIgnoreCase("Market data update...")) {
            Window ownerStage = primaryStage.getScene().getWindow();
            DataUpdateDialog dlg = new DataUpdateDialog(application, ownerStage, fm, config, true);
            dlg.sizeToScene();
            dlg.show();
         }
        }
    };
}
 
開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:15,代碼來源:MenuCreator.java


注:本文中的javafx.event.ActionEvent.getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。