summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/svg/app/beans
diff options
context:
space:
mode:
authorkitfox2007-05-30 01:33:23 +0200
committerkitfox2007-05-30 01:33:23 +0200
commit091a1e0179cb264cc2cab6e3b11ea31045c8536d (patch)
treebd561534d16012c9d398acf32398968e14a19b85 /src/main/java/com/kitfox/svg/app/beans
parentreverting to original source tree (diff)
downloadsvg-salamander-core-091a1e0179cb264cc2cab6e3b11ea31045c8536d.tar.gz
svg-salamander-core-091a1e0179cb264cc2cab6e3b11ea31045c8536d.tar.xz
svg-salamander-core-091a1e0179cb264cc2cab6e3b11ea31045c8536d.zip
Restoring SVG Salamander to it's original code base, and updating build scripts.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@36 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
Diffstat (limited to 'src/main/java/com/kitfox/svg/app/beans')
-rw-r--r--src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.form29
-rw-r--r--src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.java91
-rw-r--r--src/main/java/com/kitfox/svg/app/beans/SVGIcon.java385
-rw-r--r--src/main/java/com/kitfox/svg/app/beans/SVGPanel.form13
-rw-r--r--src/main/java/com/kitfox/svg/app/beans/SVGPanel.java243
5 files changed, 761 insertions, 0 deletions
diff --git a/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.form b/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.form
new file mode 100644
index 0000000..81fa33a
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.form
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Events>
+ <EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentResized"/>
+ <EventHandler event="componentShown" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentShown"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
+ <Property name="useNullLayout" type="boolean" value="true"/>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
+ <AbsoluteConstraints x="80" y="90" width="280" height="160"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.java b/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.java
new file mode 100644
index 0000000..be947db
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/app/beans/ProportionalLayoutPanel.java
@@ -0,0 +1,91 @@
+/*
+ * ProportionalLayoutPanel.java
+ *
+ * Created on May 7, 2005, 4:15 AM
+ */
+
+package com.kitfox.svg.app.beans;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+
+/**
+ * Panel based on the null layout. Allows editing with absolute layout. When
+ * instanced, records layout dimensions of all subcomponents. Then, if the
+ * panel is ever resized, scales all children to fit new size.
+ *
+ * @author kitfox
+ */
+public class ProportionalLayoutPanel extends javax.swing.JPanel
+{
+ public static final long serialVersionUID = 1;
+
+ //Margins to leave on sides of panel, expressed in fractions [0 1]
+ float topMargin;
+ float bottomMargin;
+ float leftMargin;
+ float rightMargin;
+
+ /** Creates new form ProportionalLayoutPanel */
+ public ProportionalLayoutPanel()
+ {
+ initComponents();
+ }
+
+ public void addNotify()
+ {
+ super.addNotify();
+
+ Rectangle rect = this.getBounds();
+ JOptionPane.showMessageDialog(this, "" + rect);
+ }
+
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents()
+ {
+ jPanel1 = new javax.swing.JPanel();
+
+ setLayout(null);
+
+ addComponentListener(new java.awt.event.ComponentAdapter()
+ {
+ public void componentResized(java.awt.event.ComponentEvent evt)
+ {
+ formComponentResized(evt);
+ }
+ public void componentShown(java.awt.event.ComponentEvent evt)
+ {
+ formComponentShown(evt);
+ }
+ });
+
+ add(jPanel1);
+ jPanel1.setBounds(80, 90, 280, 160);
+
+ }
+ // </editor-fold>//GEN-END:initComponents
+
+ private void formComponentShown(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_formComponentShown
+ {//GEN-HEADEREND:event_formComponentShown
+ JOptionPane.showMessageDialog(this, "" + getWidth() + ", " + getHeight());
+
+ }//GEN-LAST:event_formComponentShown
+
+ private void formComponentResized(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_formComponentResized
+ {//GEN-HEADEREND:event_formComponentResized
+// TODO add your handling code here:
+ }//GEN-LAST:event_formComponentResized
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel jPanel1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/src/main/java/com/kitfox/svg/app/beans/SVGIcon.java b/src/main/java/com/kitfox/svg/app/beans/SVGIcon.java
new file mode 100644
index 0000000..acb5bb5
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/app/beans/SVGIcon.java
@@ -0,0 +1,385 @@
+/*
+ * SVGIcon.java
+ *
+ * Created on April 21, 2005, 10:45 AM
+ */
+
+package com.kitfox.svg.app.beans;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.geom.*;
+import java.net.*;
+import java.beans.*;
+
+import com.kitfox.svg.*;
+
+/**
+ *
+ * @author kitfox
+ */
+public class SVGIcon implements Icon
+{
+ public static final long serialVersionUID = 1;
+
+ private PropertyChangeSupport changes = new PropertyChangeSupport(this);
+
+ SVGUniverse svgUniverse = SVGCache.getSVGUniverse();
+ public static final int INTERP_NEAREST_NEIGHBOR = 0;
+ public static final int INTERP_BILINEAR = 1;
+ public static final int INTERP_BICUBIC = 2;
+
+ private boolean antiAlias;
+ private int interpolation = INTERP_NEAREST_NEIGHBOR;
+ private boolean clipToViewbox;
+
+// private String svgPath;
+ URI svgURI;
+
+ private boolean scaleToFit;
+ AffineTransform scaleXform = new AffineTransform();
+
+// Dimension preferredSize = new Dimension(100, 100);
+ Dimension preferredSize;
+
+ /** Creates a new instance of SVGIcon */
+ public SVGIcon()
+ {
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener p)
+ {
+ changes.addPropertyChangeListener(p);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener p)
+ {
+ changes.removePropertyChangeListener(p);
+ }
+
+ /**
+ * @return height of this icon
+ */
+ public int getIconHeight()
+ {
+ if (scaleToFit && preferredSize != null)
+ {
+ return preferredSize.height;
+ }
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return 0;
+ return (int)diagram.getHeight();
+ }
+
+ /**
+ * @return width of this icon
+ */
+ public int getIconWidth()
+ {
+ if (scaleToFit && preferredSize != null)
+ {
+ return preferredSize.width;
+ }
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return 0;
+ return (int)diagram.getWidth();
+ }
+
+ /**
+ * Draws the icon to the specified component.
+ * @param comp - Component to draw icon to. This is ignored by SVGIcon, and can be set to null; only gg is used for drawing the icon
+ * @param gg - Graphics context to render SVG content to
+ * @param x - X coordinate to draw icon
+ * @param y - Y coordinate to draw icon
+ */
+ public void paintIcon(Component comp, Graphics gg, int x, int y)
+ {
+ Graphics2D g = (Graphics2D)gg;
+
+ Object oldAliasHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
+
+ Object oldInterpolationHint = g.getRenderingHint(RenderingHints.KEY_INTERPOLATION);
+ switch (interpolation)
+ {
+ case INTERP_NEAREST_NEIGHBOR:
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
+ break;
+ case INTERP_BILINEAR:
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ break;
+ case INTERP_BICUBIC:
+ g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ break;
+ }
+
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return;
+
+ g.translate(x, y);
+ diagram.setIgnoringClipHeuristic(!clipToViewbox);
+ if (clipToViewbox)
+ {
+ g.setClip(new Rectangle2D.Float(0, 0, diagram.getWidth(), diagram.getHeight()));
+ }
+
+
+
+ if (!scaleToFit)
+ {
+ try
+ {
+ diagram.render(g);
+ g.translate(-x, -y);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAliasHint);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ return;
+ }
+
+ final int width = getIconWidth();
+ final int height = getIconHeight();
+// int width = getWidth();
+// int height = getHeight();
+
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+// if (width == 0 || height == 0)
+// {
+// //Chances are we're rendering offscreen
+// Dimension dim = getSize();
+// width = dim.width;
+// height = dim.height;
+// return;
+// }
+
+// g.setClip(0, 0, width, height);
+
+
+ final Rectangle2D.Double rect = new Rectangle2D.Double();
+ diagram.getViewRect(rect);
+
+ scaleXform.setToScale(width / rect.width, height / rect.height);
+
+ AffineTransform oldXform = g.getTransform();
+ g.transform(scaleXform);
+
+ try
+ {
+ diagram.render(g);
+ }
+ catch (SVGException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ g.setTransform(oldXform);
+
+
+ g.translate(-x, -y);
+
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAliasHint);
+ if (oldInterpolationHint != null) g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, oldInterpolationHint);
+ }
+
+ /**
+ * @return the universe this icon draws it's SVGDiagrams from
+ */
+ public SVGUniverse getSvgUniverse()
+ {
+ return svgUniverse;
+ }
+
+ public void setSvgUniverse(SVGUniverse svgUniverse)
+ {
+ SVGUniverse old = this.svgUniverse;
+ this.svgUniverse = svgUniverse;
+ changes.firePropertyChange("svgUniverse", old, svgUniverse);
+ }
+
+ /**
+ * @return the uni of the document being displayed by this icon
+ */
+ public URI getSvgURI()
+ {
+ return svgURI;
+ }
+
+ /**
+ * Loads an SVG document from a URI.
+ * @param svgURI - URI to load document from
+ */
+ public void setSvgURI(URI svgURI)
+ {
+ URI old = this.svgURI;
+ this.svgURI = svgURI;
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram != null)
+ {
+ Dimension size = getPreferredSize();
+ if (size == null)
+ {
+ size = new Dimension((int)diagram.getRoot().getDeviceWidth(), (int)diagram.getRoot().getDeviceHeight());
+ }
+ diagram.setDeviceViewport(new Rectangle(0, 0, size.width, size.height));
+ }
+
+ changes.firePropertyChange("svgURI", old, svgURI);
+ }
+
+ /**
+ * Loads an SVG document from the classpath. This function is equivilant to
+ * setSvgURI(new URI(getClass().getResource(resourcePath).toString());
+ * @param resourcePath - resource to load
+ */
+ public void setSvgResourcePath(String resourcePath)
+ {
+ URI old = this.svgURI;
+
+ try
+ {
+ svgURI = new URI(getClass().getResource(resourcePath).toString());
+ changes.firePropertyChange("svgURI", old, svgURI);
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram != null)
+ {
+ diagram.setDeviceViewport(new Rectangle(0, 0, preferredSize.width, preferredSize.height));
+ }
+
+ }
+ catch (Exception e)
+ {
+ svgURI = old;
+ }
+ }
+
+ /**
+ * If this SVG document has a viewbox, if scaleToFit is set, will scale the viewbox to match the
+ * preferred size of this icon
+ */
+ public boolean isScaleToFit()
+ {
+ return scaleToFit;
+ }
+
+ public void setScaleToFit(boolean scaleToFit)
+ {
+ boolean old = this.scaleToFit;
+ this.scaleToFit = scaleToFit;
+ changes.firePropertyChange("scaleToFit", old, scaleToFit);
+ }
+
+ public Dimension getPreferredSize()
+ {
+ if (preferredSize == null)
+ {
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram != null)
+ {
+ //preferredSize = new Dimension((int)diagram.getWidth(), (int)diagram.getHeight());
+ setPreferredSize(new Dimension((int)diagram.getWidth(), (int)diagram.getHeight()));
+ }
+ }
+
+ return new Dimension(preferredSize);
+ }
+
+ public void setPreferredSize(Dimension preferredSize)
+ {
+ Dimension old = this.preferredSize;
+ this.preferredSize = preferredSize;
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram != null)
+ {
+ diagram.setDeviceViewport(new Rectangle(0, 0, preferredSize.width, preferredSize.height));
+ }
+
+ changes.firePropertyChange("preferredSize", old, preferredSize);
+ }
+
+
+ /**
+ * @return true if antiAliasing is turned on.
+ * @deprecated
+ */
+ public boolean getUseAntiAlias()
+ {
+ return getAntiAlias();
+ }
+
+ /**
+ * @param antiAlias true to use antiAliasing.
+ * @deprecated
+ */
+ public void setUseAntiAlias(boolean antiAlias)
+ {
+ setAntiAlias(antiAlias);
+ }
+
+ /**
+ * @return true if antiAliasing is turned on.
+ */
+ public boolean getAntiAlias()
+ {
+ return antiAlias;
+ }
+
+ /**
+ * @param antiAlias true to use antiAliasing.
+ */
+ public void setAntiAlias(boolean antiAlias)
+ {
+ boolean old = this.antiAlias;
+ this.antiAlias = antiAlias;
+ changes.firePropertyChange("antiAlias", old, antiAlias);
+ }
+
+ /**
+ * @return interpolation used in rescaling images
+ */
+ public int getInterpolation()
+ {
+ return interpolation;
+ }
+
+ /**
+ * @param interpolation Interpolation value used in rescaling images.
+ * Should be one of
+ * INTERP_NEAREST_NEIGHBOR - Fastest, one pixel resampling, poor quality
+ * INTERP_BILINEAR - four pixel resampling
+ * INTERP_BICUBIC - Slowest, nine pixel resampling, best quality
+ */
+ public void setInterpolation(int interpolation)
+ {
+ int old = this.interpolation;
+ this.interpolation = interpolation;
+ changes.firePropertyChange("interpolation", old, interpolation);
+ }
+
+ /**
+ * clipToViewbox will set a clip box equivilant to the SVG's viewbox before
+ * rendering.
+ */
+ public boolean isClipToViewbox()
+ {
+ return clipToViewbox;
+ }
+
+ public void setClipToViewbox(boolean clipToViewbox)
+ {
+ this.clipToViewbox = clipToViewbox;
+ }
+
+}
diff --git a/src/main/java/com/kitfox/svg/app/beans/SVGPanel.form b/src/main/java/com/kitfox/svg/app/beans/SVGPanel.form
new file mode 100644
index 0000000..b404a39
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/app/beans/SVGPanel.form
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+</Form>
diff --git a/src/main/java/com/kitfox/svg/app/beans/SVGPanel.java b/src/main/java/com/kitfox/svg/app/beans/SVGPanel.java
new file mode 100644
index 0000000..396bd9b
--- /dev/null
+++ b/src/main/java/com/kitfox/svg/app/beans/SVGPanel.java
@@ -0,0 +1,243 @@
+/*
+ * SVGIcon.java
+ *
+ * Created on April 21, 2005, 10:43 AM
+ */
+
+package com.kitfox.svg.app.beans;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.geom.*;
+import java.net.*;
+import java.beans.*;
+
+import com.kitfox.svg.*;
+
+/**
+ *
+ * @author kitfox
+ */
+public class SVGPanel extends JPanel
+{
+ public static final long serialVersionUID = 1;
+
+
+ SVGUniverse svgUniverse = SVGCache.getSVGUniverse();
+
+ private boolean antiAlias;
+
+// private String svgPath;
+ URI svgURI;
+
+ private boolean scaleToFit;
+ AffineTransform scaleXform = new AffineTransform();
+
+ /** Creates new form SVGIcon */
+ public SVGPanel()
+ {
+ initComponents();
+ }
+
+ public int getSVGHeight()
+ {
+ if (scaleToFit) return getPreferredSize().height;
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return 0;
+ return (int)diagram.getHeight();
+ }
+
+ public int getSVGWidth()
+ {
+ if (scaleToFit) return getPreferredSize().width;
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return 0;
+ return (int)diagram.getWidth();
+ }
+
+// Draw the icon at the specified location.
+ public void paintComponent(Graphics gg)
+ {
+ super.paintComponent(gg);
+
+ Graphics2D g = (Graphics2D)gg;
+
+ Object oldAliasHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
+
+
+ SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
+ if (diagram == null) return;
+
+ if (!scaleToFit)
+ {
+ try
+ {
+ diagram.render(g);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAliasHint);
+ }
+ catch (SVGException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return;
+ }
+
+ Dimension dim = getSize();
+ final int width = dim.width;
+ final int height = dim.height;
+// int width = getWidth();
+// int height = getHeight();
+
+// if (width == 0 || height == 0)
+// {
+// //Chances are we're rendering offscreen
+// Dimension dim = getSize();
+// width = dim.width;
+// height = dim.height;
+// return;
+// }
+
+// g.setClip(0, 0, dim.width, dim.height);
+
+
+ final Rectangle2D.Double rect = new Rectangle2D.Double();
+ diagram.getViewRect(rect);
+
+ scaleXform.setToScale(width / rect.width, height / rect.height);
+
+ AffineTransform oldXform = g.getTransform();
+ g.transform(scaleXform);
+
+ try
+ {
+ diagram.render(g);
+ }
+ catch (SVGException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ g.setTransform(oldXform);
+
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAliasHint);
+ }
+
+ public SVGUniverse getSvgUniverse()
+ {
+ return svgUniverse;
+ }
+
+ public void setSvgUniverse(SVGUniverse svgUniverse)
+ {
+ SVGUniverse old = this.svgUniverse;
+ this.svgUniverse = svgUniverse;
+ firePropertyChange("svgUniverse", old, svgUniverse);
+ }
+
+ public URI getSvgURI()
+ {
+ return svgURI;
+ }
+
+ public void setSvgURI(URI svgURI)
+ {
+ URI old = this.svgURI;
+ this.svgURI = svgURI;
+ firePropertyChange("svgURI", old, svgURI);
+ }
+
+ /**
+ * Most resources your component will want to access will be resources on your classpath.
+ * This method will interpret the passed string as a path in the classpath and use
+ * Class.getResource() to determine the URI of the SVG.
+ */
+ public void setSvgResourcePath(String resourcePath) throws SVGException
+ {
+ URI old = this.svgURI;
+
+ try
+ {
+ svgURI = new URI(getClass().getResource(resourcePath).toString());
+//System.err.println("SVGPanel: new URI " + svgURI + " from path " + resourcePath);
+
+ firePropertyChange("svgURI", old, svgURI);
+
+ repaint();
+ }
+ catch (Exception e)
+ {
+ throw new SVGException("Could not resolve path " + resourcePath, e);
+// svgURI = old;
+ }
+ }
+
+ public boolean isScaleToFit()
+ {
+ return scaleToFit;
+ }
+
+ public void setScaleToFit(boolean scaleToFit)
+ {
+ boolean old = this.scaleToFit;
+ this.scaleToFit = scaleToFit;
+ firePropertyChange("scaleToFit", old, scaleToFit);
+ }
+
+ /**
+ * @return true if antiAliasing is turned on.
+ * @deprecated
+ */
+ public boolean getUseAntiAlias()
+ {
+ return getAntiAlias();
+ }
+
+ /**
+ * @param antiAlias true to use antiAliasing.
+ * @deprecated
+ */
+ public void setUseAntiAlias(boolean antiAlias)
+ {
+ setAntiAlias(antiAlias);
+ }
+
+ /**
+ * @return true if antiAliasing is turned on.
+ */
+ public boolean getAntiAlias()
+ {
+ return antiAlias;
+ }
+
+ /**
+ * @param antiAlias true to use antiAliasing.
+ */
+ public void setAntiAlias(boolean antiAlias)
+ {
+ boolean old = this.antiAlias;
+ this.antiAlias = antiAlias;
+ firePropertyChange("antiAlias", old, antiAlias);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents()
+ {
+
+ setLayout(new java.awt.BorderLayout());
+
+ }
+ // </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+}