当前位置: 首页>>代码示例>>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;未经允许,请勿转载。