-package org.simantics.scenegraph.tests;\r
-\r
-import java.awt.*;\r
-import java.net.*;\r
-import java.io.*;\r
-\r
-import javax.swing.*;\r
-\r
-import com.kitfox.svg.*;\r
-import com.kitfox.svg.app.beans.*;\r
-\r
-\r
-class IconPanel extends JPanel\r
-{\r
- public static final long serialVersionUID = 0;\r
- \r
- SVGIcon icon;\r
- \r
- public IconPanel() {\r
- setPreferredSize(new Dimension(400, 400));\r
- }\r
-\r
- public void load() throws IOException\r
- {\r
- InputStream is = getClass().getResourceAsStream("test_caption_frame.svg");\r
- URI uri = SVGCache.getSVGUniverse().loadSVG(is, "myImage");\r
- System.out.println("loaded: " + uri);\r
- icon = new SVGIcon();\r
- icon.setSvgURI(uri);\r
- }\r
- \r
- public void paintComponent(Graphics g)\r
- {\r
- Graphics2D g2d = (Graphics2D) g;\r
- final int width = getWidth();\r
- final int height = getHeight();\r
- \r
- g.setColor(getBackground());\r
- g.fillRect(0, 0, width, height);\r
- g2d.scale(10, 10);\r
- icon.paintIcon(this, g, width/20, height/20);\r
- }\r
- \r
-}\r
-\r
-/**\r
- * @author kitfox\r
- */\r
-public class SVGIODemoFrame extends javax.swing.JFrame\r
-{\r
- public static final long serialVersionUID = 0;\r
- \r
- IconPanel panel = new IconPanel();\r
- \r
- /** Creates new form SVGIconDemo */\r
- public SVGIODemoFrame()\r
- {\r
- initComponents();\r
- try {\r
- panel.load();\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- }\r
-\r
- this.getContentPane().add(panel, BorderLayout.CENTER);\r
- \r
- pack();\r
- }\r
- \r
- /** This method is called from within the constructor to\r
- * initialize the form.\r
- * WARNING: Do NOT modify this code. The content of this method is\r
- * always regenerated by the Form Editor.\r
- */\r
- private void initComponents()\r
- {\r
-\r
- setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);\r
- setLayout(new java.awt.BorderLayout());\r
-\r
- }\r
- \r
- public static void main(String args[])\r
- {\r
- java.awt.EventQueue.invokeLater(new Runnable()\r
- {\r
- public void run()\r
- {\r
- new SVGIODemoFrame().setVisible(true);\r
- }\r
- });\r
- }\r
- \r
+package org.simantics.scenegraph.tests;
+
+import java.awt.*;
+import java.net.*;
+import java.io.*;
+
+import javax.swing.*;
+
+import com.kitfox.svg.*;
+import com.kitfox.svg.app.beans.*;
+
+
+class IconPanel extends JPanel
+{
+ public static final long serialVersionUID = 0;
+
+ SVGIcon icon;
+
+ public IconPanel() {
+ setPreferredSize(new Dimension(400, 400));
+ }
+
+ public void load() throws IOException
+ {
+ InputStream is = getClass().getResourceAsStream("test_caption_frame.svg");
+ URI uri = SVGCache.getSVGUniverse().loadSVG(is, "myImage");
+ System.out.println("loaded: " + uri);
+ icon = new SVGIcon();
+ icon.setSvgURI(uri);
+ }
+
+ public void paintComponent(Graphics g)
+ {
+ Graphics2D g2d = (Graphics2D) g;
+ final int width = getWidth();
+ final int height = getHeight();
+
+ g.setColor(getBackground());
+ g.fillRect(0, 0, width, height);
+ g2d.scale(10, 10);
+ icon.paintIcon(this, g, width/20, height/20);
+ }
+
+}
+
+/**
+ * @author kitfox
+ */
+public class SVGIODemoFrame extends javax.swing.JFrame
+{
+ public static final long serialVersionUID = 0;
+
+ IconPanel panel = new IconPanel();
+
+ /** Creates new form SVGIconDemo */
+ public SVGIODemoFrame()
+ {
+ initComponents();
+ try {
+ panel.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ this.getContentPane().add(panel, BorderLayout.CENTER);
+
+ pack();
+ }
+
+ /** 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.
+ */
+ private void initComponents()
+ {
+
+ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ setLayout(new java.awt.BorderLayout());
+
+ }
+
+ public static void main(String args[])
+ {
+ java.awt.EventQueue.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ new SVGIODemoFrame().setVisible(true);
+ }
+ });
+ }
+