diff options
| author | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-17 03:43:42 +0000 |
|---|---|---|
| committer | pjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-17 03:43:42 +0000 |
| commit | 6a89b3ea6110d8822275bf38588e2dcc00e6f057 (patch) | |
| tree | c5a9b2aa0dc8f704988bcb6ab64b0150389a1fbc /java/ImageProcessing/framework/ImageApp.java | |
| parent | 58d9f5e31a26415fe1c7d8106fcb4a724bbe81cd (diff) | |
| download | ATCD-6a89b3ea6110d8822275bf38588e2dcc00e6f057.tar.gz | |
Cleaned up a bit
Diffstat (limited to 'java/ImageProcessing/framework/ImageApp.java')
| -rw-r--r-- | java/ImageProcessing/framework/ImageApp.java | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/java/ImageProcessing/framework/ImageApp.java b/java/ImageProcessing/framework/ImageApp.java index 5c16b2c6fa5..7d4273b1fbd 100644 --- a/java/ImageProcessing/framework/ImageApp.java +++ b/java/ImageProcessing/framework/ImageApp.java @@ -8,7 +8,6 @@ import java.awt.image.*; import java.applet.*; import gjt.Separator; import gjt.Util; -import imaging.filters.Timer; public class ImageApp extends Applet { @@ -96,40 +95,44 @@ public class ImageApp extends Applet this.imageCanvas_.applyFilter (null); } - public void openURL (String url) + public int openURL (String url) { if (url == null) - { - DialogManager.popDialog (DialogType.MALFORMED_URL, - "Error: Malformed URL"); - return; - } - Image image; + return -1; + + Image image = null; try { - if (url.compareTo ("pj") == 0) // This is just for debugging... - image = getImage (new URL ("http://www.cs/~pjain/myphoto.gif")); - else - image = getImage (new URL (url)); + image = getImage (new URL (url)); } catch (MalformedURLException e) { - DialogManager.popDialog (DialogType.MALFORMED_URL, - "Error: Malformed URL"); - return; + return -1; } if (image != null) - this.imageCanvas_.setImage (image); + { + // Check if the image was actually loaded. Note that we have + // to wait for the potential image to finish loading before we + // know if it is a valid image. + if (this.imageCanvas_.setImage (image) == -1) + return -1; + else + this.filePanel_.enableSaveButton (); + } else - DialogManager.popDialog (DialogType.URL_NOT_FOUND, - "Error: URL not found"); + return -1; + return 0; } - public void saveFile () + public void saveFile (String url) { - DialogManager.popDialog (DialogType.NOT_YET_IMPLEMENTED, - "Save File: Not yet implemented "); + ImageSender imageSender = new ImageSender (); + imageSender.open (this.imageCanvas_.getImage (), url); + int bytesSent = imageSender.send (); + System.out.println ("Sent: " + bytesSent); + // DialogManager.popDialog (DialogType.NOT_YET_IMPLEMENTED, + // "Save File: " + url); } public Choice getFilters () @@ -260,19 +263,6 @@ public class ImageApp extends Applet private HelpPanel helpPanel_; private StatusDisplay statusDisplay_; - - // Now create all the buttons - private Button URLDialogButton_ = new Button ("Open URL"); - private Button saveButton_ = new Button ("Save"); - private Button reloadButton_ = new Button ("Reload Filters"); - private Button applyButton_ = new Button ("Apply"); - private Button resetButton_ = new Button ("Reset"); - private Button aboutButton_ = new Button ("About"); - - private Button zoomInButton_ = new Button ("<< Zoom in"); - private Button zoomOutButton_ = new Button ("Zoom out >>"); - - private Hashtable filterTable_ = new Hashtable (); private ImageFilterFactory iff_ = new ImageFilterFactory (); // private FilterRepository filterRepository_ = new FilterRepository (); |
