Java Code Examples for javafx.event.ActionEvent

The following are top voted examples for showing how to use javafx.event.ActionEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: cemu_UI   File: JFXTextAreaInfoDialog.java   View source code 8 votes vote down vote up
public void show() {
	textArea = new JFXTextArea(bodyText);
	
	JFXDialogLayout content = new JFXDialogLayout();
	content.setHeading(new Text(headingText));
	content.setBody(textArea);
	content.setPrefSize(dialogWidth, dialogHeight);
	StackPane stackPane = new StackPane();
	stackPane.autosize();
	JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
	JFXButton button = new JFXButton("Okay");
	button.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent event) {
			dialog.close();
		}
	});
	button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
	button.setPrefHeight(32);
	button.setStyle(dialogBtnStyle);
	content.setActions(button);
	pane.getChildren().add(stackPane);
	AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
	AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
	dialog.show();
}
 
Example 2
Project: ReqMan   File: GroupPropertiesScene.java   View source code 6 votes vote down vote up
@Override
public void handleSaving(ActionEvent event) {
    String name = tfName.getText();
    String projectName = tfProjectName.getText();

    if (StringUtils.isNotEmpty(name)) {
        if (!handler.isGroupNameUnique(name)) {
            Utils.showWarningDialog("Invalid group name", "Group names must be unique. There is already another group with name: \n\n" + name);
            return;
        }

        group = new Group(name, projectName, memberToStringList(tableData), catalogueName);
        if (StringUtils.isNotEmpty(tfExportFileName.getText())) {
            group.setExportFileName(tfExportFileName.getText());
        }
        dismiss();
    } else {
        String msg = "";
        if (!StringUtils.isNotEmpty(name)) {
            msg += "Group name is missing.\n";
        }
        Utils.showWarningDialog("Mandatory field(s) missing", msg);
        return;
    }
}
 
Example 3
Project: Squid   File: SquidUIController.java   View source code 6 votes vote down vote up
private void buildExpressionMenuMRU() {

        openRecentExpressionFileMenu.getItems().clear();
        List<String> mruExpressionList = squidPersistentState.getMRUExpressionList();
        for (String expressionFileName : mruExpressionList) {
            MenuItem menuItem = new MenuItem(expressionFileName);
            menuItem.setOnAction((ActionEvent t) -> {

                if (!loadExpressionFromXMLFile(new File(menuItem.getText()))) {
                    squidPersistentState.removeExpressionFileNameFromMRU(menuItem.getText());
                    squidPersistentState.cleanExpressionListMRU();
                    openRecentExpressionFileMenu.getItems().remove(menuItem);
                }
            });
            openRecentExpressionFileMenu.getItems().add(menuItem);
        }
    }
 
Example 4
Project: community-In-Action   File: FXMLDocumentController.java   View source code 6 votes vote down vote up
@FXML
public void refreshList(ActionEvent event) throws IOException {

    problems.getItems().clear();

    try {
        String query = "select * from problem";
        result = statement.executeQuery(query);

        while (result.next()) {
            String description = result.getString("title");
            items.add(description);
        }
    } catch (SQLException ex) {
        System.out.println(ex);
    }

}
 
Example 5
Project: Java-9-Programming-Blueprints   File: ConnectToPhoneController.java   View source code 6 votes vote down vote up
@FXML
public void connectToPhone(ActionEvent event) {
    String address = phoneAddress.getText();
    String code = securityCode.getText();
    preferences.setPhoneAddress(address);
    final ConversationService conversationService = 
            ConversationService.getInstance();

    conversationService.setPhoneAddress(address);
    Optional<String> token = conversationService
            .getAuthorization(code);
    if (token.isPresent()) {
        preferences.setToken(token.get());
        closeDialog(event);
    }
}
 
Example 6
Project: ABC-List   File: TestdataApplication.java   View source code 6 votes vote down vote up
private void onCloseRequest() {
    final char borderSign = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0);
    final String message = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__MESSAGE_STOP);
    final String title = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__TITLE);
    LoggerFacade.getDefault().message(borderSign, 80, message + title);
    
    try {
        TestdataFacade.getDefault().shutdown();
    } catch (InterruptedException e) {
    }
    
    Injector.forgetAll();
    DatabaseFacade.getDefault().shutdown();
    
    final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125);
    pt.setOnFinished((ActionEvent event) -> {
        Platform.exit();
    });
    pt.playFromStart();
}
 
Example 7
Project: FYS_T3   File: homepageController.java   View source code 6 votes vote down vote up
@FXML
public void openHelp(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/helpPopup.fxml"));
    final Scene scene = new Scene(root);
    final Stage stage = new Stage();
    stage.setTitle("Help");
    stage.setScene(scene);
    stage.show();
    stage.setResizable(false);
    stage.centerOnScreen();

    root.setOnKeyPressed(new EventHandler<KeyEvent>() {
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.ESCAPE) {
                System.out.println("Key Pressed: " + ke.getCode());
                stage.close();
            }
        }
    });
}
 
Example 8
Project: FYS_T3   File: contactController.java   View source code 6 votes vote down vote up
@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);
            }
        }
    });
}
 
Example 9
Project: Squid   File: SquidUIController.java   View source code 6 votes vote down vote up
private void buildProjectMenuMRU() {
    openRecentSquidProjectMenu.setDisable(false);

    openRecentSquidProjectMenu.getItems().clear();
    List<String> mruProjectList = squidPersistentState.getMRUProjectList();
    for (String projectFileName : mruProjectList) {
        MenuItem menuItem = new MenuItem(projectFileName);
        menuItem.setOnAction((ActionEvent t) -> {
            try {
                openProject(menuItem.getText());
            } catch (IOException iOException) {
                squidPersistentState.removeProjectFileNameFromMRU(menuItem.getText());
                squidPersistentState.cleanProjectListMRU();
                openRecentSquidProjectMenu.getItems().remove(menuItem);
            }
        });
        openRecentSquidProjectMenu.getItems().add(menuItem);
    }
}
 
Example 10
Project: cemu_UI   File: MainWindowController.java   View source code 5 votes vote down vote up
@FXML
void autoUpdateToggleBtnAction(ActionEvent event) {
	if (isAutoUpdate()) {
		setAutoUpdate(false);
	} else {
		setAutoUpdate(true);
	}
	saveSettings();
}
 
Example 11
Project: Java-9-Programming-Blueprints   File: Controller.java   View source code 5 votes vote down vote up
@FXML
public void runProcessHandler(final ActionEvent event) {
    final TextInputDialog inputDlg = new TextInputDialog();
    inputDlg.setTitle("Run command...");
    inputDlg.setContentText("Command Line:");
    inputDlg.setHeaderText(null);
    inputDlg.showAndWait().ifPresent(c -> {
        try {
            new ProcessBuilder(c).start();
            processListUpdater.updateList();
        } catch (IOException e) {
            new Alert(Alert.AlertType.ERROR, "There was an error running your command.").show();
        }
    });
}
 
Example 12
Project: KutuphaneOtomasyonSistemi   File: AyarlarController.java   View source code 5 votes vote down vote up
@FXML
  private void kaydetButonuTiklandi(ActionEvent event) throws IOException
  {
int kacGun=Integer.parseInt(maksimumGun.getText());
double ceza=Double.parseDouble(cezaGun.getText());
String kadi=kullaniciAdi.getText();
String pass=sifreAdi.getText();

  	Secimler secimler=Secimler.getSecimler();
  	secimler.setMaksimumGunSayisi(kacGun);
  	secimler.setGunBasiCeza(ceza);
  	secimler.setKullaniciadi(kadi);
  	secimler.setPassword(pass);
  	
  	secimler.writeToFile(secimler);
  }
 
Example 13
Project: Squid   File: SpotManagerController.java   View source code 5 votes vote down vote up
@FXML
private void saveSpotNameAction(ActionEvent event) {
    if (saveSpotNameButton.getUserData() != null) {
        ((PrawnFile.Run) saveSpotNameButton.getUserData()).getPar().get(0).setValue(selectedSpotNameText.getText().trim());
        squidProject.processPrawnSessionForDuplicateSpotNames();
        squidProject.generatePrefixTreeFromSpotNames();
        shrimpFractionList.refresh();
        shrimpRefMatList.refresh();
        shrimpConcentrationRefMatList.refresh();

        // refresh textbox in case "DUP" is removed or created
        selectedSpotNameText.setText(((PrawnFile.Run) saveSpotNameButton.getUserData()).getPar().get(0).getValue());
    }
}
 
Example 14
Project: ReqMan   File: MainHandler.java   View source code 5 votes vote down vote up
@Override
public void handleExportGroups(ActionEvent event) {
    if (!evaluatorHandler.isGroupLoaded()) {
        return;
    }
    evaluatorHandler.exportAllGroups();
}
 
Example 15
Project: Money-Manager   File: AboutController.java   View source code 5 votes vote down vote up
@FXML
private void mnuBankSettings(ActionEvent event) {
	(new TabAccess()).setTabName("tabBank");
	Stage AboutStage = (Stage) btnSignOut.getScene().getWindow();
	(new GoToOperation()).goToSettings(AboutStage.getX(), AboutStage.getY());
	AboutStage.close();
}
 
Example 16
Project: Dr-Assistant   File: PatientsController.java   View source code 5 votes vote down vote up
@FXML
private void handleSearchButton(ActionEvent event) {
    if (tfSearch.getText() == null || tfSearch.getText().trim().length() == 0) {
        patientDefault = true;
        loadPatients();

    } else {
        System.out.println("Hear");
        searchPatient(tfSearch.getText().trim());
    }
}
 
Example 17
Project: FYS_T3   File: submitController.java   View source code 5 votes vote down vote up
@FXML
public void openHome(ActionEvent event) throws IOException {
    MyJDBC.createTestDatabase("shabo");
    Node node = (Node) event.getSource();
    final Stage stage = (Stage) node.getScene().getWindow();
    final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    final Scene hScene = new Scene(home);
    Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    stage.centerOnScreen();

    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);
            }
        }
    });
}
 
Example 18
Project: Dr-Assistant   File: TemplatesController.java   View source code 5 votes vote down vote up
@FXML
private void tfSearchOnAction(ActionEvent event) {
    if (tfSearch.getText() == null || tfSearch.getText().trim().length() == 0) {
        loadData();
    } else {
        searchData(tfSearch.getText().trim());
    }
}
 
Example 19
Project: Steam-trader-tools   File: AppController.java   View source code 5 votes vote down vote up
@FXML
private void addApp(ActionEvent event) throws IOException
{
    Stage stage = new Stage();
    ResourceBundle bundle = I18n.getResourceBundle();
    AddGameController addGameController = new AddGameController(allAppList, userAppList, controllerBinder,imageCacheHandler);
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/matthieu42/steamtradertools/view/addgameview.fxml"), bundle);
    loader.setController(addGameController);
    AnchorPane root = loader.load();
    Scene addGameScene = new Scene(root);
    String css = AppController.class.getResource("/com/matthieu42/steamtradertools/view/style.css").toExternalForm();
    addGameScene.getStylesheets().add(css);
    stage.setScene(addGameScene);
    stage.show();

}
 
Example 20
Project: Money-Manager   File: SettingsController.java   View source code 5 votes vote down vote up
@FXML
private void mnuCreateSector(ActionEvent event) {
	(new TabAccess()).setTabName("tabSector");
	Stage SettingsStage = (Stage) btnSignOut.getScene().getWindow();
	(new GoToOperation()).goToSettings(SettingsStage.getX(), SettingsStage.getY());
	SettingsStage.close();
}
 
Example 21
Project: Money-Manager   File: TransactionHistoryController.java   View source code 5 votes vote down vote up
@FXML
private void mnuGetMoney(ActionEvent event) {
	(new TabAccess()).setTabName("tabGetMoney");
	Stage TransactionHistoryStage = (Stage) btnSignOut.getScene().getWindow();
	(new GoToOperation()).goToMakeATransaction(TransactionHistoryStage.getX(), TransactionHistoryStage.getY());
	TransactionHistoryStage.close();
}
 
Example 22
Project: OpenDiabetes   File: MainGuiController.java   View source code 5 votes vote down vote up
@FXML
private void handleSetToDefaultButton(ActionEvent event) {
    Alert alert = new Alert(Alert.AlertType.WARNING);
    alert.setTitle(null);
    alert.setHeaderText(null);
    alert.setContentText("Nothing happened :)");
    alert.showAndWait();
}
 
Example 23
Project: Mod-Detection-Tools   File: ModDetectionController.java   View source code 5 votes vote down vote up
private void runModFinder(ActionEvent actionEvent) {
    String cascadeValue = (String) stageChoice.getValue(); //cascadexx
    double scale = scaleSlider.getValue();
    int neighbours = Math.toIntExact(Math.round(neighbourSlider.getValue()));
    String fileLocation = recogniser.run(cascadeValue, scale, neighbours);
    Image image = new Image("file:" + fileLocation);
    imageViewer.setImage(image);
    imageViewer.fitWidthProperty().bind(imageViewer.getScene().widthProperty().subtract(200));
}
 
Example 24
Project: World-of-Zuul-SDU   File: FXMLDocumentController.java   View source code 5 votes vote down vote up
@FXML
private void talkButtonAction(ActionEvent event) {
    String talkTarget = "";
    if (event.getSource() == talkButton) {
        talkTarget = roomInventory.getSelectionModel().getSelectedItem();
        textOutArea.appendText("\n" + talkText(talkTarget));
    }
}
 
Example 25
Project: Java-9-Programming-Blueprints   File: FXMLController.java   View source code 5 votes vote down vote up
@FXML
public void openFiles(ActionEvent event) {
    matchingFilesListView.getSelectionModel().getSelectedItems()
            .forEach(f -> {
                try {
                    Desktop.getDesktop().open(new File(f.getPath()));
                } catch (IOException ex) {
                    Logger.getLogger(FXMLController.class.getName()).log(Level.SEVERE, null, ex);
                }
            });
}
 
Example 26
Project: HotaruFX   File: EditorController.java   View source code 5 votes vote down vote up
@FXML
private void handleMenuOpen(ActionEvent event) {
    val isOpened = documentManager.open(primaryStage, editor::replaceText);
    if (isOpened) {
        updateTitle();
    }
}
 
Example 27
Project: Squid   File: SquidUIController.java   View source code 5 votes vote down vote up
@FXML
private void specifyIsotopesMenuItemAction(ActionEvent event) {
    mainPane.getChildren().remove(isotopesManagerUI);
    squidProject.getTask().buildSquidSpeciesModelList();
    launchIsotopesManager();
    showUI(isotopesManagerUI);
}
 
Example 28
Project: Mafia-TCoS-CS319-Group2A   File: WelcomeScreen.java   View source code 5 votes vote down vote up
@FXML
void mute(ActionEvent event) {

    if (isMute)
        SoundManager.get().play();

    else
        SoundManager.get().stop();

    isMute = !isMute;
}
 
Example 29
Project: ReqMan   File: MainHandler.java   View source code 5 votes vote down vote up
@Override
public void handleModMS(ActionEvent event) {
    if (mainScene.isEditorActive()) {
        if (editorHandler.isCatalogueLoaded()) {
            editorHandler.handleModification(CUDEvent.generateModificationEvent(event, TargetEntity.MILESTONE, editorHandler.getSelectedMS()));
        }
    }
}
 
Example 30
Project: stvs   File: SpecificationsPaneController.java   View source code 5 votes vote down vote up
private void onTabSetName(ActionEvent actionEvent) {
  Tab activeTab = view.getTabPane().getSelectionModel().getSelectedItem();
  ConstraintSpecification activeSpec = controllers.get(activeTab).getSpec();
  TextInputDialog textInputDialog = new TextInputDialog(activeSpec.getName());
  textInputDialog.setHeaderText("Set Specification Name");
  textInputDialog.setTitle("Specification Name");
  textInputDialog.showAndWait();
  if (textInputDialog.getResult() != null) {
    activeSpec.setName(textInputDialog.getResult());
  }
}
 
Example 31
Project: ReqMan   File: MainHandler.java   View source code 5 votes vote down vote up
@Override
public void handleModCat(ActionEvent event) {
    if (mainScene.isEditorActive()) {
        if (editorHandler.isCatalogueLoaded()) {
            editorHandler.handle(CUDEvent.generateModificationEvent(event, TargetEntity.CATALOGUE, null));// By design, can be null
        }
    }

}
 
Example 32
Project: Java-9-Programming-Blueprints   File: Controller.java   View source code 5 votes vote down vote up
@FXML
public void removeAccount(ActionEvent e) {
    int index = accountsListView.getSelectionModel().getSelectedIndex();
    Account account = accountsListView.getSelectionModel().getSelectedItem();
    accounts.remove(account);
    accountsListView.getSelectionModel().select(index > 1 ? index - 1 : 0);
}
 
Example 33
Project: ETUmulator   File: HelpMenuController.java   View source code 5 votes vote down vote up
@FXML
private void aboutOnAction(ActionEvent event) throws IOException {
    ClassLoader classLoader = getClass().getClassLoader();
    FXMLLoader fxmlLoader = new FXMLLoader(classLoader.getResource("fxml/About.fxml"));
    Parent root = (Parent) fxmlLoader.load();
    Scene scene = new Scene(root);
    Stage stage = new Stage();
    stage.setTitle("About ETUmulator");
    stage.setScene(scene);
    stage.show();
}
 
Example 34
Project: OpenVSP3Plugin   File: JavaFXUI.java   View source code 5 votes vote down vote up
@FXML
void unselectAllAction(ActionEvent event) {
	LOG.trace("unselectAllAction()");
	ObservableList<DesignVariable> list;
	list = tableView.getItems();
	// update the label after all the changes are made
	ignoreUpdate = true;
	list.forEach((DesignVariable dv) -> dv.checkedProperty().set(false));
	ignoreUpdate = false;
	updateLabel();
}
 
Example 35
Project: Dr-Assistant   File: NewTemplateController.java   View source code 5 votes vote down vote up
@FXML
private void handleUpdateButton(ActionEvent event) {
    int durgId = comboBoxDrug.getSelectionModel().getSelectedItem().getId();
    String drugName = comboBoxDrug.getSelectionModel().getSelectedItem().getName();
    sl = templateDrugList.get(index).getId();
    templateDrug = new TemplateDrug(sl, durgId, drugName, tfDrugType.getText(), tfDrugStrength.getText(), tfDrugDose.getText(), tfDrugDuration.getText(), tfDrugAdvice.getText());
    templateDrugList.set(index, templateDrug);
    loadDrugTable();
    btnSave.setVisible(true);
    btnUpdate.setVisible(false);
    resetDrugForm();
}
 
Example 36
Project: Goliath-Overclocking-Utility-FX   File: FanProfileEditPane.java   View source code 5 votes vote down vote up
@Override
public void handle(ActionEvent event)
{
    InstanceProvider.getCurrentFanProfile().getNodes().remove(tempTable.getSelectionModel().getSelectedItem());
    tempTable.getItems().remove(tempTable.getSelectionModel().getSelectedItem());
    tempTable.sort();
}
 
Example 37
Project: creacoinj   File: WalletPasswordController.java   View source code 5 votes vote down vote up
@FXML void confirmClicked(ActionEvent event) {
    String password = pass1.getText();
    if (password.isEmpty() || password.length() < 4) {
        informationalAlert("Bad password", "The password you entered is empty or too short.");
        return;
    }

    final KeyCrypterScrypt keyCrypter = (KeyCrypterScrypt) Main.bitcoin.wallet().getKeyCrypter();
    checkNotNull(keyCrypter);   // We should never arrive at this GUI if the wallet isn't actually encrypted.
    KeyDerivationTasks tasks = new KeyDerivationTasks(keyCrypter, password, getTargetTime()) {
        @Override
        protected final void onFinish(KeyParameter aesKey, int timeTakenMsec) {
            checkGuiThread();
            if (Main.bitcoin.wallet().checkAESKey(aesKey)) {
                WalletPasswordController.this.aesKey.set(aesKey);
            } else {
                log.warn("User entered incorrect password");
                fadeOut(progressMeter);
                fadeIn(widgetGrid);
                fadeIn(explanationLabel);
                fadeIn(buttonsBox);
                informationalAlert("Wrong password",
                        "Please try entering your password again, carefully checking for typos or spelling errors.");
            }
        }
    };
    progressMeter.progressProperty().bind(tasks.progress);
    tasks.start();

    fadeIn(progressMeter);
    fadeOut(widgetGrid);
    fadeOut(explanationLabel);
    fadeOut(buttonsBox);
}
 
Example 38
Project: jedai-ui   File: Step2Controller.java   View source code 5 votes vote down vote up
/**
 * Display a window for configuration of the selected method's parameters.
 *
 * @param actionEvent Button event
 */
public void customizeParameters(ActionEvent actionEvent) {
    // Get method instance in order for the modal to get its configuration
    String methodName = model.getBlockBuilding();
    IDocumentation method = BlockBuildingMethod.getDefaultConfiguration(
            MethodMapping.blockBuildingMethods.get(methodName)
    );

    // Display the configuration modal
    MethodConfiguration.displayModal(getClass(), injector, method, model.blockBuildingParametersProperty());
}
 
Example 39
Project: alchem   File: AddPurchaseController.java   View source code 5 votes vote down vote up
public void onAddPurchase(ActionEvent actionEvent)
{
    Node source = (Node) actionEvent.getSource();
    Stage currentStage = (Stage) source.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("../../Resources/Layouts/alert_stage.fxml"));

    onAddEntry(currentStage, fxmlLoader);
}
 
Example 40
Project: Steam-trader-tools   File: SettingsController.java   View source code 5 votes vote down vote up
@FXML
void deleteImageCache(ActionEvent event) {
    try
    {
        imageCacheHandler.deleteImageCache();
    } catch (ImageCacheError imageCacheError)
    {
        JFXSnackbar error = new JFXSnackbar(root);
        error.show(I18n.getMessage("errorcachefolder"), 3000);
    }
}