/** Creates new form SVGViewer */ public SVGPlayer() { initComponents(); setSize(800, 600); svgDisplayPanel.setBgColor(Color.white); svgDisplayPanel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent evt) { SVGDiagram diagram = svgDisplayPanel.getDiagram(); if (diagram == null) return; System.out.println("Picking at cursor (" + evt.getX() + ", " + evt.getY() + ")"); try { List paths = diagram.pick(new Point2D.Float(evt.getX(), evt.getY()), null); for (int i = 0; i < paths.size(); i++) { ArrayList path = (ArrayList) paths.get(i); System.out.println(pathToString(path)); } } catch (SVGException ex) { ex.printStackTrace(); } } }); svgDisplayPanel.setPreferredSize(getSize()); scrollPane_svgArea.setViewportView(svgDisplayPanel); playerDialog = new PlayerDialog(this); }
/** Creates new form SVGViewer */ public SVGViewer() { initComponents(); setSize(800, 600); svgDisplayPanel.setBgColor(Color.white); svgDisplayPanel.setPreferredSize(getSize()); panel_svgArea.add(svgDisplayPanel, BorderLayout.CENTER); // scrollPane_svgArea.setViewportView(svgDisplayPanel); }