X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph%2Ftestcases%2Forg%2Fsimantics%2Fscenegraph%2Ftests%2FSVGIODemoFrame.java;h=dcf351f887e4b49c7cf5e6657d554d797816b225;hb=63ff14b2e48d0acca5483692eb7886f347db7565;hp=f46155ff042e0b70aa3e29c30fd10c4ced7255f5;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph/testcases/org/simantics/scenegraph/tests/SVGIODemoFrame.java b/bundles/org.simantics.scenegraph/testcases/org/simantics/scenegraph/tests/SVGIODemoFrame.java index f46155ff0..dcf351f88 100644 --- a/bundles/org.simantics.scenegraph/testcases/org/simantics/scenegraph/tests/SVGIODemoFrame.java +++ b/bundles/org.simantics.scenegraph/testcases/org/simantics/scenegraph/tests/SVGIODemoFrame.java @@ -1,94 +1,94 @@ -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); - } - }); - } - +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); + } + }); + } + } \ No newline at end of file