mirror of
https://github.com/csharpee/Map-Projections.git
synced 2025-12-10 00:00:19 -05:00
error messages that you can read
I discoverd that the error pane automaticly cuts off the last few words of your error message if it can fit *almost* the whole message on one line. god, javafx is stupid. I hacked at it until it wraps consistently so that *all* – not just *almost all* – of the words I ask it to show the user are actually shown to the user.
This commit is contained in:
parent
2e5205e379
commit
fbfe0f07bc
@ -32,6 +32,7 @@ import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
@ -56,6 +57,7 @@ import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.StackPane;
|
||||
@ -686,7 +688,12 @@ public abstract class MapApplication extends Application {
|
||||
protected static void showError(String header, String message) { //a simple error handling thing
|
||||
final Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||
alert.setHeaderText(header);
|
||||
alert.setContentText(message);
|
||||
Text contentText = new Text(message);
|
||||
contentText.setWrappingWidth(350);
|
||||
StackPane contentPane = new StackPane(contentText);
|
||||
contentPane.setPadding(new Insets(10, 10, 10, 10));
|
||||
contentPane.setAlignment(Pos.CENTER);
|
||||
alert.getDialogPane().setContent(contentPane);
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
|
||||
@ -142,13 +142,16 @@ public class MapDesignerVector extends MapApplication {
|
||||
protected void failed() {
|
||||
if (getException() instanceof IOException)
|
||||
showError("File not found!",
|
||||
"We couldn't find "+file.getAbsolutePath()+".");
|
||||
"We couldn't find "+file.getAbsolutePath()+".");
|
||||
else if (getException() instanceof SAXException)
|
||||
showError("Unreadable file!",
|
||||
"We couldn't read "+file.getAbsolutePath()+". It may be corrupt or an unreadable format.");
|
||||
"We couldn't read "+file.getAbsolutePath()+". It may be corrupt or an unreadable format. " +
|
||||
"If you think your SVG file is valid, leave an issue on the GitHub (https://github.com/" +
|
||||
"jkunimune/Map-Projections/issues) or send me an email (justin.kunimune@gmail.com) and " +
|
||||
"I'll see if I can find out why this isn't working.");
|
||||
else if (getException() instanceof ParserConfigurationException)
|
||||
showError("Parser Configuration Error!",
|
||||
"My parser configured incorrectly. I blame you.");
|
||||
"My parser configured incorrectly. I blame you.");
|
||||
else {
|
||||
getException().printStackTrace();
|
||||
showError("Unexpected error!", getException().getMessage());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user