From 29a0a556b272bc4ac84649ae6b3e710c8e84722f Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Wed, 17 Oct 2007 08:53:13 +0000 Subject: [PATCH] Negative image export size check. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@451 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/userinterface/graph/GUIImageExportDialog.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/prism/src/userinterface/graph/GUIImageExportDialog.java b/prism/src/userinterface/graph/GUIImageExportDialog.java index 0e069a0b..0aff97a5 100644 --- a/prism/src/userinterface/graph/GUIImageExportDialog.java +++ b/prism/src/userinterface/graph/GUIImageExportDialog.java @@ -154,10 +154,10 @@ public class GUIImageExportDialog extends JDialog implements DocumentListener allPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); bottomPanel.setLayout(new java.awt.BorderLayout()); - warningLabel.setText("Please enter positive integers"); + warningLabel.setText("Please enter positive integers for width and height."); warningLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0)); bottomPanel.add(warningLabel, java.awt.BorderLayout.CENTER); - warningLabel.getAccessibleContext().setAccessibleName("Please enter a positive integer for both width and height"); + warningLabel.getAccessibleContext().setAccessibleName("Please enter a positive integer for both width and height."); buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); @@ -285,7 +285,9 @@ public class GUIImageExportDialog extends JDialog implements DocumentListener try { exportWidth = Integer.parseInt(widthInputField.getText()); + if (exportWidth <= 0) throw new NumberFormatException(); exportHeight = Integer.parseInt(heightInputField.getText()); + if (exportHeight <= 0) throw new NumberFormatException(); GUIImageExportDialog.this.warningLabel.setVisible(false); GUIImageExportDialog.this.okayButton.setEnabled(true); }