javafx.event.ActionEvent Java Examples

The following examples show how to use javafx.event.ActionEvent. 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 File: MainMenuController.java    From logbook-kai with 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 #2
Source File: RequireNdockController.java    From logbook-kai with 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 #3
Source File: AlarmClockTableController.java    From MyBox with 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 #4
Source File: MainDashboardController.java    From School-Management-System with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: RadioChooserDialog.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #6
Source File: FilesRenameController.java    From MyBox with 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 #7
Source File: MainToolbar.java    From Quelea with 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 #8
Source File: ConnectionController.java    From Spring-generator with 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 File: EditProjectSettingsAction.java    From arma-dialog-creator with 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 #10
Source File: SelectionTableToolbar.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
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 #11
Source File: ProfileController.java    From oim-fx with 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 #12
Source File: MainMenuController.java    From MyBox with 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 File: SingleImageAnalyzerController.java    From FakeImageDetection with GNU General Public License v3.0 5 votes vote down vote up
@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 #14
Source File: About.java    From PeerWasp with 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 #15
Source File: SetAbstractSqlController.java    From Vert.X-generator with 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 #16
Source File: MetacheatUI.java    From jace with 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 #17
Source File: ProductRegisterController.java    From dctb-utfpr-2018-1 with 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 #18
Source File: FXMLAwardCategoryController.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
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 #19
Source File: MainScreenController.java    From SmartCity-ParkingManagement with Apache License 2.0 5 votes vote down vote up
@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 #20
Source File: OpenFileByEditorAction.java    From jmonkeybuilder with 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 #21
Source File: MainMenuController.java    From logbook-kai with 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);
    }
}
 
Example #22
Source File: RightSideMainController.java    From Hostel-Management-System with MIT License 5 votes vote down vote up
@FXML
private void HelpButtonAction(ActionEvent event)
{
    try
    {
        MainProgramSceneController.RightSideofSplitPane.getChildren().set(0, ((Parent) FXMLLoader.load(getClass().getResource("Help.fxml"))));
    } catch (IOException ex)
    {
    }
}
 
Example #23
Source File: UpDownHandler.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(ActionEvent event) {
    MultipleSelectionModel<ClassPathElement> selectionModel = classPathListView.getSelectionModel();
    ObservableList<ClassPathElement> items = classPathListView.getItems();
    int selectedIndex = selectionModel.getSelectedIndex();
    ClassPathElement selectedItem = selectionModel.getSelectedItem();
    items.remove(selectedItem);
    if (shouldMoveUp) {
        items.add(selectedIndex - 1, selectedItem);
    } else {
        items.add(selectedIndex + 1, selectedItem);
    }
    selectionModel.clearAndSelect(items.indexOf(selectedItem));
}
 
Example #24
Source File: ManageStaffsController.java    From School-Management-System with Apache License 2.0 5 votes vote down vote up
@FXML
void Back(ActionEvent event) {
    try {
        AnchorPane studentMgmt = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/StaffManagement.fxml")));
        root.getChildren().setAll(studentMgmt);
    }catch(IOException e){
        System.out.println(e);
    }
}
 
Example #25
Source File: GUIController.java    From density-converter with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(ActionEvent event) {
    directoryChooser.setTitle(bundle.getString("main.dirchooser.titel"));
    File dir = new File(textFieldPath.getText());

    if (dir != null && dir.isFile()) {
        dir = dir.getParentFile();
    }

    while (true) {
        if (dir == null || dir.isDirectory()) break;
        if (!dir.exists()) {
            dir = dir.getParentFile();
        }
    }

    if (textFieldPath.getText().isEmpty() || !dir.exists() || !dir.isDirectory()) {
        directoryChooser.setInitialDirectory(new File(System.getProperty("user.home")));
    } else {
        directoryChooser.setInitialDirectory(dir);
    }
    File srcFile = directoryChooser.showDialog(textFieldPath.getScene().getWindow());
    if (srcFile != null) {
        textFieldPath.setText(srcFile.getAbsolutePath());
        if (dstTextFieldPath != null && (dstTextFieldPath.getText() == null || dstTextFieldPath.getText().trim().isEmpty())) {
            dstTextFieldPath.setText(srcFile.getAbsolutePath());
        }
    }
}
 
Example #26
Source File: KendrickMassPlotWindowController.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@FXML
void divisorDownZ(ActionEvent event) {
  logger.finest("Divisor Z-axis down");
  int minDivisor = getMinimumRecommendedDivisor(customZAxisKMBase);
  int maxDivisor = getMaximumRecommendedDivisor(customZAxisKMBase);
  if (zAxisDivisor > minDivisor && zAxisDivisor <= maxDivisor) {
    zAxisDivisor--;
    zAxisDivisor = checkDivisor(zAxisDivisor, useRKM_Z, customZAxisKMBase, false);
  }
  XYPlot plot = getChart().getXYPlot();
  kendrickVariableChanged(plot);
}
 
Example #27
Source File: MainController.java    From Noexes with GNU General Public License v3.0 5 votes vote down vote up
public void connect(ActionEvent event) {
    connectionService.setOnSucceeded(value -> {
        IConnection conn = (IConnection) value.getSource().getValue();
        setConn(new Debugger(conn));
    });
    connectionService.setOnFailed(value -> {
        if (connectionService.getCurrentFailureCount() < connectionService.getMaximumFailureCount() - 1) {
            return;
        }
        setStatus("Unable to Connect!");
        setConnectBtnText("Connect");
        connectionType.setDisable(false);
        ipAddr.setDisable(connectionType.getSelectionModel().getSelectedItem() != ConnectionType.NETWORK);
    });

    boolean disabled = false;
    if (connectionService.isRunning()) {
        setConnectBtnText("Connect");
        connectionService.cancel();
        setStatus("Connect Canceled");
    } else if (debugger != null && debugger.connected()) { // Disconnect
        try {
            debugger.close();
            fire(IController::onDisconnect);
            connectBtn.setDisable(false);
        } catch (Exception ignored) {
        }
    } else {
        disabled = true;
        setConnectBtnText("Cancel");
        connectionService.setType(connectionType.getSelectionModel().getSelectedItem());
        connectionService.setHost(ipAddr.getText());
        connectionService.setPort(DEFAULT_PORT);
        connectionService.restart();
    }
    ipAddr.setDisable(disabled);
    connectionType.setDisable(disabled);
}
 
Example #28
Source File: SetAbstractSqlController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example #29
Source File: LoginController.java    From oim-fx with MIT License 5 votes vote down vote up
public void processLogin(ActionEvent event) {
    if (application == null){
        // We are running in isolated FXML, possibly in Scene Builder.
        // NO-OP.
        errorMessage.setText("Hello " + userId.getText());
    } else {
        if (!application.userLogging(userId.getText(), password.getText())){
            errorMessage.setText("Username/Password is incorrect");
        }
    }
}
 
Example #30
Source File: ToolsController.java    From G-Earth with MIT License 5 votes vote down vote up
public void btnEncodeInt_clicked(ActionEvent actionEvent) {
    ByteBuffer b = ByteBuffer.allocate(4);
    b.putInt(Integer.parseInt(txt_intDecoded.getText()));

    HPacket packet = new HPacket(b.array());
    txt_intEncoded.setText(packet.toString());
}