use of javafx.event.ActionEvent in project ETUmulator by kasirgalabs.
the class FileMenuController method openRecentFilesOnAction.
@FXML
private void openRecentFilesOnAction(ActionEvent event) {
openRecentTab = (Menu) event.getSource();
openRecentTab.getItems().clear();
MenuItem menuItem;
if (controlRecent) {
for (int i = recentFiles.size() - 1; i >= 0; i--) {
File file = recentFiles.get(i);
menuItem = new MenuItem(recentFiles.get(i).getName());
openRecentTab.getItems().add(menuItem);
menuItem.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
if (file != null) {
StringBuilder text = new StringBuilder(256);
try (BufferedReader bf = new BufferedReader(new FileReader(file))) {
String line;
while ((line = bf.readLine()) != null) {
text.append(line).append('\n');
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
document.setText(text.toString());
document.setTargetFile(file);
}
}
});
}
}
controlRecent = false;
}
use of javafx.event.ActionEvent in project ETUmulator by kasirgalabs.
the class PopUp method createPopup.
/**
*Creating Popup to show exceptions in new window.
*
*In implementation users cannot edit the popUp's TextArea.
*/
public void createPopup() {
console.setEditable(false);
Stage stage = new Stage();
stage.setTitle("Exception(s)!");
VBox box = new VBox();
box.setPadding(new Insets(5));
box.setAlignment(Pos.CENTER);
Button btnClose = new Button();
btnClose.setText("Close");
btnClose.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
stage.close();
console.clear();
}
});
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
stage.close();
console.clear();
}
});
Button btnClear = new Button();
btnClear.setText("Clear");
btnClear.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
console.clear();
}
});
box.getChildren().add(console);
box.getChildren().add(btnClose);
box.getChildren().add(btnClear);
Scene scene1 = new Scene(box, 500, 250);
stage.setScene(scene1);
stage.show();
}
use of javafx.event.ActionEvent in project SIMVA-SoS by SESoS.
the class ChartViewer method createContextMenu.
/**
* Creates the context menu.
*
* @return The context menu.
*/
private ContextMenu createContextMenu() {
final ContextMenu menu = new ContextMenu();
Menu export = new Menu("Export As");
MenuItem pngItem = new MenuItem("PNG...");
pngItem.setOnAction((ActionEvent e) -> {
handleExportToPNG();
});
export.getItems().add(pngItem);
MenuItem jpegItem = new MenuItem("JPEG...");
jpegItem.setOnAction((ActionEvent e) -> {
handleExportToJPEG();
});
export.getItems().add(jpegItem);
if (ExportUtils.isOrsonPDFAvailable()) {
MenuItem pdfItem = new MenuItem("PDF...");
pdfItem.setOnAction((ActionEvent e) -> {
handleExportToPDF();
});
export.getItems().add(pdfItem);
}
if (ExportUtils.isJFreeSVGAvailable()) {
MenuItem svgItem = new MenuItem("SVG...");
svgItem.setOnAction((ActionEvent e) -> {
handleExportToSVG();
});
export.getItems().add(svgItem);
}
menu.getItems().add(export);
return menu;
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class SettingsController method unarchiveSource.
@FXML
private void unarchiveSource(ActionEvent event) {
try {
source.unarchiveSource(sourcecmboUnArchive.getValue());
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText(sourcecmboUnArchive.getValue() + " is Unarchived Successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
tabSourceInitialize();
} catch (Exception e) {
}
}
use of javafx.event.ActionEvent in project Money-Manager by krHasan.
the class SettingsController method systembtnSave.
@FXML
private void systembtnSave(ActionEvent event) {
DateFormatManager format = new DateFormatManager();
try {
String timeFormat = (String) timerbtnGroup.getSelectedToggle().getUserData();
String dateFormat = (String) daterbtnGroup.getSelectedToggle().getUserData();
format.setTimeFormate(timeFormat);
format.setDateFormate(dateFormat);
updateLastAccessDate();
if (checkBoxWeekNum.isSelected()) {
setWeekStatus(true);
} else {
setWeekStatus(false);
}
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Message");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("Information updated successfully");
Stage SettingsStage = (Stage) btnDashboard.getScene().getWindow();
confirmationMsg.setX(SettingsStage.getX() + 200);
confirmationMsg.setY(SettingsStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
tabSystemInitialize();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations