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


Java PMouseWheelZoomEventHandler类代码示例

本文整理汇总了Java中org.piccolo2d.event.PMouseWheelZoomEventHandler的典型用法代码示例。如果您正苦于以下问题:Java PMouseWheelZoomEventHandler类的具体用法?Java PMouseWheelZoomEventHandler怎么用?Java PMouseWheelZoomEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ZoomableTextDemo

import org.piccolo2d.event.PMouseWheelZoomEventHandler; //导入依赖的package包/类
public ZoomableTextDemo() {
    super("Zoomable Text Demo", false, null);
    setSize(480, 320);
    setLocationRelativeTo(null);
    getCanvas().removeInputEventListener(getCanvas().getZoomEventHandler());
    
    // disable panning
    //getCanvas().removeInputEventListener(getCanvas().getPanEventHandler());
    getCanvas().addInputEventListener(new PMouseWheelZoomEventHandler());
    //getCanvas().addInputEventListener(new ScrollZoom());
}
 
开发者ID:clearlyspam23,项目名称:JAnGLE,代码行数:12,代码来源:ZoomableTextDemo.java

示例2: SwingPiccoloTest

import org.piccolo2d.event.PMouseWheelZoomEventHandler; //导入依赖的package包/类
public SwingPiccoloTest() {
        super("Zoomable Swing GUI Demo - Swing Wrapper");
         
//        JPanel panel = new TileLayer();
//        panel.setLayout(new GridLayout(200, 200, 0, 0));
//        panel.enableInputMethods(false);
//        PSwing swingWrapper = new PSwing(panel);
        
        //JButton button = new JButton();
        
        //PSwing wrapper = new PSwing(button);
         
        PSwingCanvas canvas = new PSwingCanvas();
        canvas.removeInputEventListener(canvas.getZoomEventHandler());
        PMouseWheelZoomEventHandler eh = new PMouseWheelZoomEventHandler();
        eh.zoomAboutMouse();
        canvas.addInputEventListener(eh);
        canvas.setBackground(Color.blue);
        nodes = new PImage[20][20];
        for(int i = 0; i < nodes.length; i++)
        {
        	for(int j = 0; j < nodes[i].length; j++)
        	{
        		nodes[i][j] = new PImage();
        		nodes[i][j].setPaint(Color.BLUE);
        		canvas.getLayer().addChild(nodes[i][j]);
        		nodes[i][j].setBounds(i*16, j*16, 16, 16);
        		nodes[i][j].addInputEventListener(new ClickListener(i, j));
        	}
        }
        //canvas.getLayer().addChild(wrapper);
        //canvas.getLayer().addChild(swingWrapper);
         
        add(canvas, BorderLayout.CENTER);
         
        setSize(400, 300);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    
        setLocationRelativeTo(null);
    }
 
开发者ID:clearlyspam23,项目名称:JAnGLE,代码行数:40,代码来源:SwingPiccoloTest.java

示例3: TestLevelPanel

import org.piccolo2d.event.PMouseWheelZoomEventHandler; //导入依赖的package包/类
public TestLevelPanel()
	{
		canvas = new PSwingCanvas();
		setLayout(new BorderLayout());
		
		Template t = new Template();
		
		TileLayerDefinition def = new TileLayerDefinition();
		
		TileLayerTemplate template = new TileLayerTemplate(def);
		template.setDefaultGridDimensions(32, 32);
		
		level = new Level(t);
		level.setDimensions(320, 320);
		Layer layer = template.createLayer();
		layer.onResize(level, level.getWidth(), level.getHeight());
		level.addLayer(layer);
		
		add(canvas, BorderLayout.CENTER);
		
		PNode base = new PNode();
		canvas.getLayer().addChild(base);
		
		for(Layer l : level.getLayers())
		{
			base.addChild(l.getLayerGUI());
		}
		//need some way to determine currentLayer, for now this will have to do
		
		Layer<?> currentLayer = level.getLayers().get(level.getLayers().size()-1);
		
		TileLayerEditManager data = new TileLayerEditManager();
//		data.setCurrentTileset(new Tileset(new Image[][]{{tile}}));
//		data.setSelectedIndex(0, 0);
//		for(PInputEventListener l : currentLayer.getListeners())
//			canvas.addInputEventListener(l);
//		
//		for(LayerEditorDialog d : currentLayer.getEditors((Frame)this.getParent())){
//			d.setVisible(true);
//		}
		
		PLayer pLayer = canvas.getLayer();
		
		canvas.getPanEventHandler().setEventFilter(new PInputEventFilter(InputEvent.BUTTON3_MASK));
        canvas.removeInputEventListener(canvas.getZoomEventHandler());
        PMouseWheelZoomEventHandler eh = new PMouseWheelZoomEventHandler();
        eh.zoomAboutMouse();
        eh.setScaleFactor(-0.1);
        canvas.addInputEventListener(eh); 
        addComponentListener(this);
        
//        System.out.println("initial: " + canvas.getWidth() + ", " + canvas.getHeight());
		

        this.setVisible(true);
        this.validate();
	}
 
开发者ID:clearlyspam23,项目名称:JAnGLE,代码行数:58,代码来源:TestLevelPanel.java

示例4: LevelPanel

import org.piccolo2d.event.PMouseWheelZoomEventHandler; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
	public LevelPanel(Level level, Frame frame, Map<LayerEditManager<?>, JDialog> editDialogs)
	{
		myFrame = frame;
		canvas = new PSwingCanvas();
		canvas.setDefaultRenderQuality(PPaintContext.LOW_QUALITY_RENDERING);
		canvas.setBackground(Color.white);
		
		this.level = level;
		level.addChangeListener(this);
		background = new PNode();
		background.setPaint(backgroundColor);
		background.setBounds(0, 0, level.getWidth(), level.getHeight());
		
		base = new PNode();
		
		outline = new FixedWidthOutlineRectNode(8, canvas.getCamera());
		outline.setBounds(0, 0, level.getWidth(), level.getHeight());
		outline.setPickable(false);
		outline.setChildrenPickable(false);
//		
		
		setLayout(new BorderLayout());
		
		this.editDialogs = editDialogs;
		
//		level = new Level(t);
//		level.setDimensions(320, 320);
//		Layer layer = template.createLayer();
//		layer.onResize(level.getWidth(), level.getHeight());
//		level.addLayer(layer);
		
		add(canvas, BorderLayout.CENTER);
		
		canvas.getLayer().addChild(base);
		base.addChild(background);
		
		for(Layer l : level.getLayers())
		{
			PNode node = l.getLayerGUI();
			layers.add(node);
			editors.add(l.getEditManager());
			base.addChild(node);
		}
		canvas.getLayer().addChild(outline);
		//need some way to determine currentLayer, for now this will have to do
		changeLayer(level.getLayers().size()-1);
		
		canvas.getPanEventHandler().setEventFilter(new PInputEventFilter(InputEvent.BUTTON3_MASK));
        canvas.removeInputEventListener(canvas.getZoomEventHandler());
        PMouseWheelZoomEventHandler eh = new PMouseWheelZoomEventHandler();
        eh.zoomAboutMouse();
        eh.setScaleFactor(-0.1);
        canvas.addInputEventListener(eh); 
        addComponentListener(this);
        
        dialog = new LayerSelectionDialog(frame, level.getLayers(), layers, this);
		dialog.setSize(150, 600);
        
//        System.out.println("initial: " + canvas.getWidth() + ", " + canvas.getHeight());
		

        this.setVisible(true);
        this.validate();
	}
 
开发者ID:clearlyspam23,项目名称:JAnGLE,代码行数:66,代码来源:LevelPanel.java


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