本文整理匯總了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();
}