本文整理汇总了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();
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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();
}
}
});
}
示例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);
}
}
});
}
示例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);
}
}
示例10: autoUpdateToggleBtnAction
import javafx.event.ActionEvent; //导入依赖的package包/类
@FXML
void autoUpdateToggleBtnAction(ActionEvent event) {
if (isAutoUpdate()) {
setAutoUpdate(false);
} else {
setAutoUpdate(true);
}
saveSettings();
}
示例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();
}
});
}
示例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);
}
示例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());
}
}
示例14: handleExportGroups
import javafx.event.ActionEvent; //导入依赖的package包/类
@Override
public void handleExportGroups(ActionEvent event) {
if (!evaluatorHandler.isGroupLoaded()) {
return;
}
evaluatorHandler.exportAllGroups();
}
示例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();
}