You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/11/14 15:34:06 UTC

cvs commit: xml-batik/sources/org/apache/batik/swing JSVGCanvas.java

hillion     01/11/14 06:34:06

  Modified:    sources/org/apache/batik/swing JSVGCanvas.java
  Log:
  The JSVGCanvas now displays a dialog-box on error.
  
  Revision  Changes    Path
  1.29      +29 -1     xml-batik/sources/org/apache/batik/swing/JSVGCanvas.java
  
  Index: JSVGCanvas.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/JSVGCanvas.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- JSVGCanvas.java	2001/10/17 11:40:29	1.28
  +++ JSVGCanvas.java	2001/11/14 14:34:06	1.29
  @@ -30,6 +30,8 @@
   import javax.swing.ActionMap;
   import javax.swing.InputMap;
   import javax.swing.JComponent;
  +import javax.swing.JDialog;
  +import javax.swing.JOptionPane;
   import javax.swing.KeyStroke;
   import javax.swing.ToolTipManager;
   
  @@ -66,7 +68,7 @@
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: JSVGCanvas.java,v 1.28 2001/10/17 11:40:29 tkormann Exp $
  + * @version $Id: JSVGCanvas.java,v 1.29 2001/11/14 14:34:06 hillion Exp $
    */
   public class JSVGCanvas extends JSVGComponent {
   
  @@ -879,6 +881,32 @@
               if (locationListener == null) {
                   locationListener = new LocationListener();
                   addMouseMotionListener(locationListener);
  +            }
  +        }
  +
  +        /**
  +         * Displays an error message in the User Agent interface.
  +         */
  +        public void displayError(String message) {
  +            if (svgUserAgent != null) {
  +                super.displayError(message);
  +            } else {
  +                JOptionPane pane;
  +                pane = new JOptionPane(message, JOptionPane.ERROR_MESSAGE);
  +                JDialog dialog = pane.createDialog(JSVGCanvas.this, "ERROR");
  +                dialog.setModal(false);
  +                dialog.show();
  +            }
  +        }
  +
  +        /**
  +         * Displays an error resulting from the specified Exception.
  +         */
  +        public void displayError(Exception ex) {
  +            if (svgUserAgent != null) {
  +                super.displayError(ex);
  +            } else {
  +                displayError(ex.getMessage());
               }
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org