本文整理汇总了Java中org.apache.batik.swing.JSVGCanvas.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java JSVGCanvas.addMouseListener方法的具体用法?Java JSVGCanvas.addMouseListener怎么用?Java JSVGCanvas.addMouseListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.batik.swing.JSVGCanvas
的用法示例。
在下文中一共展示了JSVGCanvas.addMouseListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: noViewDemo
import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
private static void noViewDemo() {
JFrame frame = new JFrame("Svg Awt Demo");
frame.setLayout(new BorderLayout());
JSVGCanvas svgCanvas = new JSVGCanvas();
svgCanvas.setDocumentState(AbstractJSVGComponent.ALWAYS_DYNAMIC);
final SvgSvgElement svgRoot = DemoModel.createModel();
SvgRootDocumentMapper mapper = new SvgRootDocumentMapper(svgRoot);
mapper.attachRoot();
svgCanvas.setSVGDocument(mapper.getTarget());
svgCanvas.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
DemoModel.addCircle(svgRoot, e.getX(), e.getY());
}
});
frame.add(svgCanvas);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(800, 600);
frame.setVisible(true);
}
示例2: createDiagramPanel
import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
private JPanel createDiagramPanel(Workflow workflow) {
final JPanel diagramPanel = new JPanel(new BorderLayout());
// get the default diagram settings
Alignment alignment = Alignment.valueOf(graphViewConfiguration
.getProperty(ALIGNMENT));
PortStyle portStyle = PortStyle.valueOf(graphViewConfiguration
.getProperty(PORT_STYLE));
boolean animationEnabled = Boolean.parseBoolean(graphViewConfiguration
.getProperty(ANIMATION_ENABLED));
int animationSpeed = Integer.parseInt(graphViewConfiguration
.getProperty(ANIMATION_SPEED));
// create an SVG canvas
final JSVGCanvas svgCanvas = new JSVGCanvas(null, true, false);
svgCanvas.setEnableZoomInteractor(false);
svgCanvas.setEnableRotateInteractor(false);
svgCanvas.setDocumentState(ALWAYS_DYNAMIC);
svgCanvas.setTransferHandler(new ServiceTransferHandler(editManager,
menuManager, selectionManager, serviceRegistry));
AutoScrollInteractor asi = new AutoScrollInteractor(svgCanvas);
svgCanvas.addMouseListener(asi);
svgCanvas.addMouseMotionListener(asi);
final JSVGScrollPane svgScrollPane = new MySvgScrollPane(svgCanvas);
GVTTreeRendererAdapter gvtTreeRendererAdapter = new GVTTreeRendererAdapter() {
@Override
public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
logger.info("Rendered svg");
svgScrollPane.reset();
diagramPanel.revalidate();
}
};
svgCanvas.addGVTTreeRendererListener(gvtTreeRendererAdapter);
// create a graph controller
SVGGraphController svgGraphController = new SVGGraphController(
workflow, selectionManager.getSelectedProfile(), false,
svgCanvas, alignment, portStyle, editManager, menuManager,
colourManager, workbenchConfiguration);
svgGraphController.setDataflowSelectionModel(selectionManager
.getDataflowSelectionModel(workflow.getParent()));
svgGraphController.setAnimationSpeed(animationEnabled ? animationSpeed
: 0);
graphControllerMap.put(workflow, svgGraphController);
// Toolbar with actions related to graph
JToolBar graphActionsToolbar = graphActionsToolbar(workflow,
svgGraphController, svgCanvas, alignment, portStyle);
graphActionsToolbar.setAlignmentX(LEFT_ALIGNMENT);
graphActionsToolbar.setFloatable(false);
// Panel to hold the toolbars
JPanel toolbarPanel = new JPanel();
toolbarPanel.setLayout(new BoxLayout(toolbarPanel, PAGE_AXIS));
toolbarPanel.add(graphActionsToolbar);
diagramPanel.add(toolbarPanel, NORTH);
diagramPanel.add(svgScrollPane, CENTER);
// JTextField workflowHierarchy = new JTextField(workflow.getName());
// diagramPanel.add(workflowHierarchy, BorderLayout.SOUTH);
return diagramPanel;
}