当前位置: 首页>>代码示例>>Java>>正文


Java JSVGCanvas.setEnablePanInteractor方法代码示例

本文整理汇总了Java中org.apache.batik.swing.JSVGCanvas.setEnablePanInteractor方法的典型用法代码示例。如果您正苦于以下问题:Java JSVGCanvas.setEnablePanInteractor方法的具体用法?Java JSVGCanvas.setEnablePanInteractor怎么用?Java JSVGCanvas.setEnablePanInteractor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.batik.swing.JSVGCanvas的用法示例。


在下文中一共展示了JSVGCanvas.setEnablePanInteractor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMainComponent

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
@Override
protected JComponent createMainComponent() {
    //scene = new Scene();
    //JScrollPane scenePane = new JScrollPane(scene.createView());
    JSVGCanvas svgCanvas = new JSVGCanvas();
    svgCanvas.setEnableImageZoomInteractor(true);
    svgCanvas.setEnablePanInteractor(true);
    svgCanvas.setEnableZoomInteractor(true);
    return svgCanvas;
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:11,代码来源:DrawingTopComponent.java

示例2: GraphPanel

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
public GraphPanel(KinDiagramPanel kinDiagramPanel, final ArbilWindowManager arbilWindowManager, SessionStorage sessionStorage, ArbilDataNodeLoader dataNodeLoader) {
        this.kinDiagramPanel = kinDiagramPanel;
        this.dialogHandler = arbilWindowManager;
        this.sessionStorage = sessionStorage;
        this.dataNodeLoader = dataNodeLoader;
//        this.entityCollection = entityCollection;
        dataStoreSvg = new DataStoreSvg();
        entitySvg = new EntitySvg(dialogHandler);
        dataStoreSvg.setDefaults();
        svgUpdateHandler = new SvgUpdateHandler(this, kinDiagramPanel, dialogHandler);
        selectedGroupId = new ArrayList<UniqueIdentifier>();
        graphPanelSize = new GraphPanelSize();
        this.setLayout(new BorderLayout());
        boolean eventsEnabled = true;
        boolean selectableText = false;
        svgCanvas = new JSVGCanvas(new GraphUserAgent(this, dialogHandler, dataNodeLoader), eventsEnabled, selectableText);
//        svgCanvas.setMySize(new Dimension(600, 400));
        svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
//        drawNodes();
        svgCanvas.setEnableImageZoomInteractor(false);
        svgCanvas.setEnablePanInteractor(false);
        svgCanvas.setEnableRotateInteractor(false);
        svgCanvas.setEnableZoomInteractor(false);
        svgCanvas.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(final MouseWheelEvent e) {
                UpdateManager updateManager = svgCanvas.getUpdateManager();
                if (updateManager != null) {
                    updateManager.getUpdateRunnableQueue().invokeLater(new Runnable() {
                        public void run() {
                            double scale = 1 - e.getUnitsToScroll() / 10.0;
                            double tx = -e.getX() * (scale - 1);
                            double ty = -e.getY() * (scale - 1);
//                                System.out.println("scale: " + scale);
//                                System.out.println("scale: " + svgCanvas.getRenderingTransform().getScaleX());
                            AffineTransform at = new AffineTransform();
                            if (e.isAltDown()) {
                                at.translate(tx, ty);
                                at.scale(scale, scale);
                            } else if (e.isShiftDown()) {
                                at.translate(-tx, 0);
                            } else {
                                at.translate(0, -ty);
                            }
                            at.concatenate(svgCanvas.getRenderingTransform());
//                                System.out.println("new scale: " + at.getScaleX());
                            if (at.getScaleX() > 0.1) {
                                svgCanvas.setRenderingTransform(at);
                            }
                        }
                    });
                }
                e.consume();
                //  show a ToolTip or StatusBar to give hints "Hold modifier + mouse wheel to zoom"
                GraphPanel.this.kinDiagramPanel.setStatusBarText("hint: alt + mouse wheel to zoom; shift + mouse wheel to pan; mouse wheel to scroll.");
            }
        });
//        svgCanvas.setEnableResetTransformInteractor(true);
//        svgCanvas.setDoubleBufferedRendering(true); // todo: look into reducing the noticable aliasing on the canvas

        jSVGScrollPane = new JSVGScrollPane(svgCanvas);
//        svgCanvas.setBackground(Color.LIGHT_GRAY);
        this.add(BorderLayout.CENTER, jSVGScrollPane);
    }
 
开发者ID:KinshipSoftware,项目名称:KinOathKinshipArchiver,代码行数:64,代码来源:GraphPanel.java


注:本文中的org.apache.batik.swing.JSVGCanvas.setEnablePanInteractor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。