本文整理汇总了Java中org.controlsfx.dialog.ExceptionDialog类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionDialog类的具体用法?Java ExceptionDialog怎么用?Java ExceptionDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionDialog类属于org.controlsfx.dialog包,在下文中一共展示了ExceptionDialog类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
logger.info(getRuntimeDetails());
Point mousePosition = MouseInfo.getPointerInfo().getLocation();
stage.setX(mousePosition.getX());
stage.setY(mousePosition.getY());
try {
dataStorage = new DataStorage();
} catch (IOException ex) {
logger.error("Could not initialize working directory", ex);
ExceptionDialog exceptionDialog = new ExceptionDialog(ex);
exceptionDialog.setTitle("Error");
exceptionDialog.setHeaderText("Could not initialize working directory");
exceptionDialog.show();
return;
}
new MainWindow(stage);
stage.setMaximized(true);
}
示例2: saveImage
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
@FXML
void saveImage() {
if (image == null) {
Alert a = new Alert(AlertType.ERROR);
a.setContentText("No image to export!");
a.show();
}
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(Preferences.getPath("lastImageDir").toFile());
fileChooser.setTitle("Save image");
fileChooser.getExtensionFilters().addAll(
new ExtensionFilter("PNG Images", "*.png"));
File selected = fileChooser.showSaveDialog(getScene().getWindow());
if (selected != null) {
Preferences.setPath("lastImageDir", selected.toPath());
try {
ImageIO.write(image.toBufferedImage(), "png", selected);
} catch (IOException e) {
logger.error("Error while saving the image.", e);
ExceptionDialog exceptionDialog = new ExceptionDialog(e);
exceptionDialog.setTitle("Error");
exceptionDialog.setHeaderText("Error while saving the image.");
exceptionDialog.show();
}
}
}
示例3: showError
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
private void showError(String message, Exception ex) {
logger.error(message, ex);
ExceptionDialog exceptionDialog = new ExceptionDialog(ex);
exceptionDialog.setTitle("Error");
exceptionDialog.setHeaderText(message);
exceptionDialog.show();
}
示例4: initialize
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
public void initialize()
{
// get URL of the video file
URL url = VideoPlayerController.class.getResource("sts117.mp4");
// create a Media object for the specified URL
Media media = new Media(url.toExternalForm());
// create a MediaPlayer to control Media playback
mediaPlayer = new MediaPlayer(media);
// specify which MediaPlayer to display in the MediaView
mediaView.setMediaPlayer(mediaPlayer);
// set handler to be called when the video completes playing
mediaPlayer.setOnEndOfMedia(() -> {
playing = false;
playPauseButton.setText("Play");
});
// set handler that displays an ExceptionDialog if an error occurs
mediaPlayer.setOnError(() -> {
ExceptionDialog dialog =
new ExceptionDialog(mediaPlayer.getError());
dialog.showAndWait();
});
// bind the MediaView's width/height to the scene's width/height
DoubleProperty width = mediaView.fitWidthProperty();
DoubleProperty height = mediaView.fitHeightProperty();
width.bind(Bindings.selectDouble(
mediaView.sceneProperty(), "width"));
height.bind(Bindings.selectDouble(
mediaView.sceneProperty(), "height"));
}
示例5: showWebsite
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
@FXML
public void showWebsite() {
try {
Node node = websiteController.initView();
content.setContent(node);
websiteController.initConstuct();
} catch (Exception e) {
Stage stage = springContext.getBean(Stage.class);
ExceptionDialog ex = new ExceptionDialog(e);
ex.initOwner(stage);
ex.show();
}
}
示例6: changeAvatar
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
private void changeAvatar(File choosen) {
try {
String uploaded = FileService.instance().upload(choosen);
Image image = FileService.instance().getImage(uploaded);
Core.instance().user().setAvatar(uploaded);
} catch (IOException ex) {
ExceptionDialog dialog = new ExceptionDialog(ex);
dialog.setTitle("Failed to upload image");
dialog.showAndWait();
}
}
示例7: displayException
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
/**
* Displays a modal dialog box to shows details about an {@link Exception}.
*
* @param header the header text for the dialog
* @param e the exception to display
* @param owner the {@link Node} used to recover the stage the dialog should be linked to
*/
public static void displayException(String header, Throwable e, Node owner) {
runOnFXThread(() -> {
ExceptionDialog dlg = new ExceptionDialog(e);
dlg.initStyle(StageStyle.UTILITY);
dlg.initOwner(getStage(owner));
dlg.getDialogPane().setHeaderText(header);
dlg.showAndWait();
});
}
示例8: handleException
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
private static void handleException(Throwable exception) {
ExceptionDialog ed = new ExceptionDialog(exception);
ed.show();
}
示例9: showErrorDialogAndWait
import org.controlsfx.dialog.ExceptionDialog; //导入依赖的package包/类
@Override
public void showErrorDialogAndWait(String message, Throwable exception) {
ExceptionDialog exceptionDialog = new ExceptionDialog(exception);
exceptionDialog.setHeaderText(message);
exceptionDialog.showAndWait();
}