Java Code Examples for javafx.event.ActionEvent

The following examples show how to use javafx.event.ActionEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: arma-dialog-creator   Source File: EditProjectSettingsAction.java    License: MIT License 6 votes vote down vote up
@Override
public void handle(ActionEvent event) {
	Project project = Project.getCurrentProject();
	EditProjectSettingsDialog dialog = new EditProjectSettingsDialog(project);
	dialog.show();
	if (dialog.wasCancelled()) {
		return;
	}
	project.setProjectName(dialog.getProjectName());
	project.setProjectDescription(dialog.getProjectDescription());
	if (dialog.moveProjectDirectory()) {
		try {
			ApplicationManager.instance.setProjectDirectoryName(project, dialog.getProjectName());
		} catch (IOException ignore) {
			ResourceBundle bundle = Lang.ApplicationBundle();
			new SimpleErrorDialog<>(
					ArmaDialogCreator.getPrimaryStage(),
					bundle.getString("Popups.EditProjectSettings.couldnt_move_project_dir_short"),
					null,
					new Label(bundle.getString("Popups.EditProjectSettings.couldnt_move_project_dir"))
			).show();
		}
	}

}
 
Example 2
@FXML
void btnStaffMgmt(ActionEvent event){

        try {
                AnchorPane user = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/StaffManagement.fxml")));
                root.getChildren().setAll(user);
        }catch(IOException e){
                System.out.println(e);
        }

        /*Parent root = null;
        try {
                root = FXMLLoader.load(getClass().getResource("/sms/view/fxml/StaffManagement.fxml"));
                Stage stage = new Stage();
                stage.setTitle("School Information");
                stage.setScene(new Scene(root));
                stage.getIcons().add(new Image(getClass().getResourceAsStream("/sms/other/img/HikmaLogo.jpg")));
                stage.show();

        } catch (IOException e) {
                e.printStackTrace();
        }*/
}
 
Example 3
Source Project: logbook-kai   Source File: RequireNdockController.java    License: MIT License 6 votes vote down vote up
/**
 * 画面の更新
 *
 * @param e ActionEvent
 */
@FXML
void update(ActionEvent e) {
    List<Ship> ndockList = ShipCollection.get()
            .getShipMap()
            .values()
            .stream()
            .filter(this::filter)
            .collect(Collectors.toList());
    if (this.ndocksHashCode == ndockList.hashCode()) {
        this.ndocks.forEach(RequireNdock::update);
    } else {
        this.ndocks.clear();
        ndockList.stream()
                .sorted(Comparator.comparing(Ship::getNdockTime, Comparator.reverseOrder()))
                .map(RequireNdock::toRequireNdock)
                .forEach(this.ndocks::add);
        this.ndocksHashCode = ndockList.hashCode();
    }
}
 
Example 4
Source Project: MyBox   Source File: FilesRenameController.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void openTarget(ActionEvent event) {
    try {
        if (tableData == null || tableData.isEmpty()) {
            return;
        }
        File f = new File(tableData.get(0).getFileName());
        if (f.isDirectory()) {
            browseURI(new File(f.getPath()).toURI());
        } else {
            browseURI(new File(f.getParent()).toURI());
        }
        recordFileOpened(f);
    } catch (Exception e) {
        logger.error(e.toString());
    }
}
 
Example 5
Source Project: Quelea   Source File: MainToolbar.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void startRecording() {
        recordAudioButton.setSelected(true);
        recording = true;
//        getItems().add(pb);
        getItems().add(recordingPathTextField);
        recordAudioButton.setText("Recording...");
        recordAudioButton.setSelected(true);
        recordingsHandler = new RecordButtonHandler();
        recordingsHandler.passVariables("rec", pb, recordingPathTextField, recordAudioButton);
        final int interval = 1000; // 1000 ms
        recCount = new Timer(interval, (java.awt.event.ActionEvent e) -> {
            recTime += interval;
            setTime(recTime, recordAudioButton);
        });
        recCount.start();
    }
 
Example 6
Source Project: MyBox   Source File: AlarmClockTableController.java    License: Apache License 2.0 6 votes vote down vote up
@FXML
private void activeAction(ActionEvent event) {
    ObservableList<AlarmClock> selected = alarmClocksView.getSelectionModel().getSelectedItems();
    if (selected == null || selected.isEmpty()) {
        return;
    }
    for (AlarmClock alarm : selected) {
        alarm.setIsActive(true);
        alarm.setStatus(AppVariables.message("Active"));
        AlarmClock.calculateNextTime(alarm);
        alarm.setNext(DateTools.datetimeToString(alarm.getNextTime()));
        AlarmClock.scehduleAlarmClock(alarm);

    }
    AlarmClock.writeAlarmClocks(selected);
    alarmClocksView.refresh();
    activeButton.setDisable(true);
    inactiveButton.setDisable(false);

}
 
Example 7
private void onOK(final ActionEvent ignored)
{
	Toggle selectedToggle = toggleGroup.getSelectedToggle();
	Logging.debugPrint("selected toggle is " + selectedToggle);
	if (selectedToggle != null)
	{
		Integer whichItemId = (Integer)selectedToggle.getUserData();
		InfoFacade selectedItem = chooser.getAvailableList().getElementAt(whichItemId);
		chooser.addSelected(selectedItem);
	}
	if (chooser.isRequireCompleteSelection() && (chooser.getRemainingSelections().get() > 0))
	{
		Dialog<ButtonType> alert = new Alert(Alert.AlertType.INFORMATION);
		alert.setTitle(chooser.getName());
		alert.setContentText(LanguageBundle.getFormattedString("in_chooserRequireComplete",
				chooser.getRemainingSelections().get()));
		alert.showAndWait();
		return;
	}
	chooser.commit();
	committed = true;
	this.dispose();
}
 
Example 8
Source Project: Spring-generator   Source File: ConnectionController.java    License: MIT License 6 votes vote down vote up
/**
 * 保存连接
 * 
 * @param event
 */
public void saveConnection(ActionEvent event) {
	LOG.debug("执行保存数据库连接...");
	DatabaseConfig config = getDatabaseConfig();
	if (config == null) {
		LOG.debug("连接数据库的数据为null,取消保存操作!!!");
		return;
	}
	try {
		ConfigUtil.saveDatabaseConfig(config.getConnName(), config);
		getDialogStage().close();
		indexController.loadTVDataBase();
		LOG.debug("保存数据库连接成功!");
	} catch (Exception e) {
		LOG.error("保存数据库连接失败!!!" , e);
		AlertUtil.showErrorAlert(e.getMessage());
	}

}
 
Example 9
Source Project: logbook-kai   Source File: MainMenuController.java    License: MIT License 6 votes vote down vote up
/**
 * バージョン情報
 *
 * @param e ActionEvent
 */
@FXML
void version(ActionEvent e) {
    try {
        InternalFXMLLoader.showWindow("logbook/gui/version.fxml", this.parentController.getWindow(), "バージョン情報",
                root -> new Scene(root, Color.TRANSPARENT),
                null,
                stage -> {
                    stage.initStyle(StageStyle.TRANSPARENT);
                    stage.focusedProperty().addListener((ob, o, n) -> {
                        if (!n) {
                            stage.close();
                        }
                    });
                });
    } catch (Exception ex) {
        LoggerHolder.get().error("設定の初期化に失敗しました", ex);
    }
}
 
Example 10
Source Project: OpenLabeler   Source File: OpenLabelerController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void onClose(ActionEvent actionEvent) {
    if (canClose()) {
        tagBoard.setModel(null);
        undoManager.forgetHistory();
        mediaPane.clear();
    }
}
 
Example 11
@FXML
public void updateFormInfo(ActionEvent event) throws SQLException {

    String customer = customerid.getText();
    String lostkoffer = lostluggageid.getText();
    String deliverer = deivererid.getText();
    String email = emailid.getText();
    String adres = adresid.getText();
    String id = this.formtextid.getText();

    if (!id.isEmpty()) {
        int updateInfo = DB.executeUpdateQuery("UPDATE passenger "
                + "                                   JOIN lostluggage ON lostluggage.passengerId = passenger.passengerId  "
                + "                                             JOIN matched on lostluggage.registrationNr = matched.lostluggage  "
                + "                                                     SET passenger.name = '" + customer + "', passenger.email = '" + email + "', passenger.address = '" + adres + "', matched.delivery = '" + deliverer + "' "
                + "                                                     WHERE lostluggage.registrationNr = '" + lostkoffer + "'");

        alertHeader = "Updated!";
        headerColor = "#f03e3e";
        alert = "The delivered luggage is updated";
        buttonText = "Ok";
        showAlertMessage();

    } else {
        alertHeader = "Something went wrong!";
        headerColor = "#f03e3e";
        alert = "Please select a row before updating details";
        buttonText = "Try again";
        showAlertMessage();
    }
}
 
Example 12
Source Project: MyBox   Source File: MainMenuController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
public void userGuideDesktopTools(ActionEvent event) {
    try {
        String link = "https://github.com/Mararsh/MyBox/releases/download/v"
                + CommonValues.AppDocVersion + "/MyBox-UserGuide-" + CommonValues.AppDocVersion
                + "-DesktopTools-" + AppVariables.getLanguage() + ".pdf";
        browseURI(new URI(link));
    } catch (Exception e) {
        logger.error(e.toString());
    }
}
 
Example 13
Source Project: marathonv5   Source File: StopWatchSample.java    License: Apache License 2.0 5 votes vote down vote up
private void configureTimeline() {
    time.setCycleCount(Timeline.INDEFINITE);
    KeyFrame keyFrame = new KeyFrame(Duration.millis(47), new EventHandler<ActionEvent>() {

        public void handle(ActionEvent event) {
            calculate();
        }
    });
    time.getKeyFrames().add(keyFrame);
}
 
Example 14
Source Project: ChatRoomFX   Source File: ChatRoom.java    License: MIT License 5 votes vote down vote up
@FXML
void closeAction(ActionEvent event) {
    try {
        controller.removeChatObserver(chatObserver);
        controller.updateClientList();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    Runtime.getRuntime().exit(0);
    ((Stage)btnClose.getScene().getWindow()).close();
}
 
Example 15
Source Project: cute-proxy   Source File: MainController.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Handle setting menu
 */
@FXML
private void updateSetting(ActionEvent e) throws IOException {
    var dialog = new MainSettingDialog();
    dialog.mainSettingProperty().setValue(context.serverSetting());
    var newConfig = dialog.showAndWait();
    if (newConfig.isPresent()) {
        var task = new SaveSettingTask(context, newConfig.get(), context.keyStoreSetting(),
                context.proxySetting());
        UIUtils.runTaskWithProcessDialog(task, "append settings failed");
    }
}
 
Example 16
Source Project: dctb-utfpr-2018-1   Source File: TemplateController.java    License: Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 17
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 18
Source Project: erlyberly   Source File: ModFuncContextMenu.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void onSeqTrace(ActionEvent ae) {
    ModFunc func = selectedItem.get();
    if(func == null)
        return;

    dbgController.seqTrace(func);

    ErlyBerly.showPane("Seq Trace", new SeqTraceView(dbgController.getSeqTraceLogs()));
}
 
Example 19
Source Project: Spring-generator   Source File: IndexController.java    License: MIT License 5 votes vote down vote up
/**
 * 打开设置CustomProperty
 * 
 * @param event
 */
public void onSetCustomProperty(ActionEvent event) {
	SetCustomPropertyController controller = (SetCustomPropertyController) loadFXMLPage("SetCustomProperty Setting",
			FXMLPage.SET_CUSTOM_PROPERTY, false);
	controller.setIndexController(this);
	controller.showDialogStage();
	controller.init();
}
 
Example 20
@FXML 
void logOutButtonClicked(ActionEvent event) throws Exception {
	Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow();
	window.setTitle("Login");
	Parent root = FXMLLoader.load(getClass().getResource("LoginScreen.fxml")); 
	window.setScene(new Scene(root, ScreenSizesConstants.LoginScreenWidth, ScreenSizesConstants.LoginScreenHeight));
	DBManager.initialize();
	window.show();
}
 
Example 21
Source Project: oim-fx   Source File: ProfileController.java    License: MIT License 5 votes vote down vote up
public void saveProfile(ActionEvent event) {
    if (application == null){
        // We are running in isolated FXML, possibly in Scene Builder.
        // NO-OP.
        animateMessage();
        return;
    }
    User loggedUser = application.getLoggedUser();
    loggedUser.setEmail(email.getText());
    loggedUser.setPhone(phone.getText());
    loggedUser.setSubscribed(subscribed.isSelected());
    loggedUser.setAddress(address.getText());
    animateMessage();
}
 
Example 22
public void loadDocuments(ActionEvent event) {
    RememberingLatestFileChooserWrapper fileChooser = FileChoosers.getFileChooser(
            DefaultI18nContext.getInstance().i18n("Select pdf documents to load"), FileType.PDF);
    List<File> chosenFiles = fileChooser.showOpenMultipleDialog(this.getScene().getWindow());
    if (chosenFiles != null && !chosenFiles.isEmpty()) {
        PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(getOwnerModule());
        chosenFiles.stream().map(PdfDocumentDescriptor::newDescriptorNoPassword).forEach(loadEvent::add);
        eventStudio().broadcast(loadEvent, getOwnerModule());
    }
}
 
Example 23
@FXML
private void loadNeuralNetwork(ActionEvent event) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Select Neural Network");
    nnetSrc = fileChooser.showOpenDialog(rootPane.getScene().getWindow());
    if (nnetSrc != null) {
        nnIndicator.setSelected(true);
    }
}
 
Example 24
Source Project: PeerWasp   Source File: About.java    License: MIT License 5 votes vote down vote up
@FXML
  private void opentomp2p(ActionEvent event) {
String tomp2p = "http://tomp2p.net/";
try {
	BrowserUtils.openURL(tomp2p);
} catch (Exception e) {
	logger.warn("Could not open TomP2P URL: '{}'", tomp2p, e);
}
  }
 
Example 25
Source Project: jace   Source File: MetacheatUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
@FXML
void pauseClicked(ActionEvent event) {
    Application.invokeLater(() -> {
        if (Emulator.computer.isRunning()) {
            Emulator.computer.pause();
        } else {
            Emulator.computer.resume();
        }
    });
}
 
Example 26
Source Project: Vert.X-generator   Source File: SetAbstractSqlController.java    License: MIT License 5 votes vote down vote up
/**
 * 添加自定义属性
 * 
 * @param event
 */
public void onAddPropertyToTable(ActionEvent event) {
	LOG.debug("执行添加自定义属性...");
	TableAttributeKeyValue attribute = new TableAttributeKeyValue(txtKey.getText(), txtValue.getText(), txtDescribe.getText());
	tblPropertyValues.add(attribute);
	LOG.debug("添加自定义属性-->成功!");
}
 
Example 27
public void upPriority(ActionEvent fxevent){
    if (awardCategory.getPriority()> 0) {
        awardCategory.getRaceAward().awardCategoriesProperty().remove(awardCategory);
        awardCategory.getRaceAward().awardCategoriesProperty().add(awardCategory.getPriority()-1, awardCategory);
        awardCategory.getRaceAward().recalcPriorities();
        awardCategory.getRaceAward().awardCategoriesProperty().forEach(a -> raceDAO.updateAwardCategory(a));
    }
}
 
Example 28
@FXML
public void newOrderButtonClicked(ActionEvent event) throws Exception {
	
		Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow();
		window.setTitle("New Order");
		FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ChooseParkingSlotScreen.fxml"));     
		Parent root = (Parent)fxmlLoader.load();          
		ChooseParkingSlotController controller = fxmlLoader.<ChooseParkingSlotController>getController();
		controller.setUserId(userId);
		window.setScene(new Scene(root, ScreenSizesConstants.MapScreenWidth, ScreenSizesConstants.MapScreenHeight));		
		window.show();
}
 
Example 29
Source Project: jmonkeybuilder   Source File: OpenFileByEditorAction.java    License: Apache License 2.0 5 votes vote down vote up
@FxThread
@Override
protected void execute(@Nullable ActionEvent event) {
    super.execute(event);

    var newEvent = new RequestedOpenFileEvent(getElement().getFile());
    newEvent.setDescription(description);

    FX_EVENT_MANAGER.notify(newEvent);
}
 
Example 30
Source Project: logbook-kai   Source File: MainMenuController.java    License: MIT License 5 votes vote down vote up
/**
 * キャプチャ
 *
 * @param e ActionEvent
 */
@FXML
void capture(ActionEvent e) {
    try {
        InternalFXMLLoader.showWindow("logbook/gui/capture.fxml", this.parentController.getWindow(), "キャプチャ");
    } catch (Exception ex) {
        LoggerHolder.get().error("キャプチャの初期化に失敗しました", ex);
    }
}