當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionEvent類代碼示例

本文整理匯總了Java中javafx.event.ActionEvent的典型用法代碼示例。如果您正苦於以下問題:Java ActionEvent類的具體用法?Java ActionEvent怎麽用?Java ActionEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ActionEvent類屬於javafx.event包,在下文中一共展示了ActionEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: show

import javafx.event.ActionEvent; //導入依賴的package包/類
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();
}
 
開發者ID:Seil0,項目名稱:cemu_UI,代碼行數:27,代碼來源:JFXTextAreaInfoDialog.java

示例2: handleSaving

import javafx.event.ActionEvent; //導入依賴的package包/類
@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;
    }
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:26,代碼來源:GroupPropertiesScene.java

示例3: buildExpressionMenuMRU

import javafx.event.ActionEvent; //導入依賴的package包/類
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);
        }
    }
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:18,代碼來源:SquidUIController.java

示例4: refreshList

import javafx.event.ActionEvent; //導入依賴的package包/類
@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);
    }

}
 
開發者ID:ioaktheo,項目名稱:community-In-Action,代碼行數:19,代碼來源:FXMLDocumentController.java

示例5: connectToPhone

import javafx.event.ActionEvent; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:17,代碼來源:ConnectToPhoneController.java

示例6: onCloseRequest

import javafx.event.ActionEvent; //導入依賴的package包/類
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();
}
 
開發者ID:Naoghuman,項目名稱:ABC-List,代碼行數:21,代碼來源:TestdataApplication.java

示例7: openHelp

import javafx.event.ActionEvent; //導入依賴的package包/類
@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();
            }
        }
    });
}
 
開發者ID:dewarian,項目名稱:FYS_T3,代碼行數:21,代碼來源:homepageController.java

示例8: 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

示例9: buildProjectMenuMRU

import javafx.event.ActionEvent; //導入依賴的package包/類
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);
    }
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:20,代碼來源:SquidUIController.java

示例10: autoUpdateToggleBtnAction

import javafx.event.ActionEvent; //導入依賴的package包/類
@FXML
void autoUpdateToggleBtnAction(ActionEvent event) {
	if (isAutoUpdate()) {
		setAutoUpdate(false);
	} else {
		setAutoUpdate(true);
	}
	saveSettings();
}
 
開發者ID:Seil0,項目名稱:cemu_UI,代碼行數:10,代碼來源:MainWindowController.java

示例11: runProcessHandler

import javafx.event.ActionEvent; //導入依賴的package包/類
@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();
        }
    });
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:16,代碼來源:Controller.java

示例12: kaydetButonuTiklandi

import javafx.event.ActionEvent; //導入依賴的package包/類
@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);
  }
 
開發者ID:mevlanayalcin,項目名稱:KutuphaneOtomasyonSistemi,代碼行數:17,代碼來源:AyarlarController.java

示例13: saveSpotNameAction

import javafx.event.ActionEvent; //導入依賴的package包/類
@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());
    }
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:15,代碼來源:SpotManagerController.java

示例14: handleExportGroups

import javafx.event.ActionEvent; //導入依賴的package包/類
@Override
public void handleExportGroups(ActionEvent event) {
    if (!evaluatorHandler.isGroupLoaded()) {
        return;
    }
    evaluatorHandler.exportAllGroups();
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:8,代碼來源:MainHandler.java

示例15: mnuBankSettings

import javafx.event.ActionEvent; //導入依賴的package包/類
@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();
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:8,代碼來源:AboutController.java


注:本文中的javafx.event.ActionEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。