本文整理匯總了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();
}
}
}
示例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);
}
}
});
}
示例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();
}
示例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() + ".");
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
});
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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");
}
}
}
示例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();
}
}
};
}