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


Java VisualizationViewer.setCursor方法代码示例

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


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

示例1: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
   * check the modifiers. If accepted, use the mouse drag motion
   * to rotate the graph
*/
  public void mouseDragged(MouseEvent e) {
      if(down == null) return;
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer =
              vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          // rotate
          vv.setCursor(cursor);
          
          Point2D center = vv.getCenter();
          Point2D q = down;
          Point2D p = e.getPoint();
          Point2D v1 = new Point2D.Double(center.getX()-p.getX(), center.getY()-p.getY());
          Point2D v2 = new Point2D.Double(center.getX()-q.getX(), center.getY()-q.getY());
          double theta = angleBetween(v1, v2);
          modelTransformer.rotate(theta, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, center));
          down.x = e.getX();
          down.y = e.getY();
      
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:28,代码来源:RotatingGraphMousePlugin.java

示例2: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer<?,?> vv = (VisualizationViewer<?,?>)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer viewTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
          vv.setCursor(cursor);
          try {
              Point2D q = viewTransformer.inverseTransform(down);
              Point2D p = viewTransformer.inverseTransform(e.getPoint());
              float dx = (float) (p.getX()-q.getX());
              float dy = (float) (p.getY()-q.getY());
              
              viewTransformer.translate(dx, dy);
              down.x = e.getX();
              down.y = e.getY();
          } catch(RuntimeException ex) {
              System.err.println("down = "+down+", e = "+e);
              throw ex;
          }
      
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:29,代码来源:ViewTranslatingGraphMousePlugin.java

示例3: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * Check the event modifiers. Set the 'down' point for later
 * use. If this event satisfies the modifiers, change the cursor
 * to the system 'move cursor'
 * @param e the event
 */
public void mousePressed(MouseEvent e) {
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    MutableTransformer vt = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
    if(vt instanceof LensTransformer) {
    	vt = ((LensTransformer)vt).getDelegate();
    }
    Point2D p = vt.inverseTransform(e.getPoint());
    boolean accepted = checkModifiers(e);
    if(accepted) {
        vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
        testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT), p);
        testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW), p);
        vv.repaint();
    }
    super.mousePressed(e);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:23,代码来源:LensTranslatingGraphMousePlugin.java

示例4: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          vv.setCursor(cursor);
          try {
              Point2D q = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
              Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
              float dx = (float) (p.getX()-q.getX());
              float dy = (float) (p.getY()-q.getY());
              
              modelTransformer.translate(dx, dy);
              down.x = e.getX();
              down.y = e.getY();
          } catch(RuntimeException ex) {
              System.err.println("down = "+down+", e = "+e);
              throw ex;
          }
      
          e.consume();
          vv.repaint();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:30,代码来源:TranslatingGraphMousePlugin.java

示例5: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    // TRANSLATING PART
    VisualizationViewer<ViwnNode, ViwnEdge> vv = (VisualizationViewer<ViwnNode, ViwnEdge>) e.getSource();
    boolean accepted = checkModifiers(e);
    down = e.getPoint();
    if (accepted) {
        vv.setCursor(cursor);
    }
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:11,代码来源:ViwnGraphViewModalGraphMouse.java

示例6: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
    // TRANSLATING PART
    final VisualizationViewer<ViwnNode, ViwnEdge> vv = (VisualizationViewer<ViwnNode, ViwnEdge>) e.getSource();
    if (down != null) {
        vv.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
    down = null;
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:10,代码来源:ViwnGraphViewModalGraphMouse.java

示例7: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	if (e.getButton() == MouseEvent.BUTTON1) {
		changed = false;

		down = e.getPoint();
		vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:12,代码来源:BetterTranslatingGraphMousePlugin.java

示例8: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	if (e.getButton() == MouseEvent.BUTTON1) {
		down = null;
		vv.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

		if (changed) {
			Stream.of(listeners.getListeners(JungListener.class)).forEach(l -> l.transformFinished());
		}
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:14,代码来源:BetterTranslatingGraphMousePlugin.java

示例9: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
   * save the 'down' point and check the modifiers. If the
   * modifiers are accepted, set the cursor to the 'hand' cursor
* @param e the event
*/
  public void mousePressed(MouseEvent e) {
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
         boolean accepted = checkModifiers(e);
         down = e.getPoint();
        if(accepted) {
             vv.setCursor(cursor);
         }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:14,代码来源:RotatingGraphMousePlugin.java

示例10: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * chack the modifiers. If accepted, translate the main view according
 * to the dragging of the mouse pointer in the satellite view
 * @param e the event
 */
public void mouseDragged(MouseEvent e) {
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    boolean accepted = checkModifiers(e);
    if(accepted) {
        if(vv instanceof SatelliteVisualizationViewer) {
            VisualizationViewer vvMaster = 
                ((SatelliteVisualizationViewer)vv).getMaster();
            
            MutableTransformer modelTransformerMaster = 
            	vvMaster.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
            vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            try {
                Point2D q = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
                Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
                float dx = (float) (p.getX()-q.getX());
                float dy = (float) (p.getY()-q.getY());
                
                modelTransformerMaster.translate(-dx, -dy);
                down.x = e.getX();
                down.y = e.getY();
            } catch(RuntimeException ex) {
                System.err.println("down = "+down+", e = "+e);
                throw ex;
            }
        }
        e.consume();
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:34,代码来源:SatelliteTranslatingGraphMousePlugin.java

示例11: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
    * Check the event modifiers. Set the 'down' point for later
    * use. If this event satisfies the modifiers, change the cursor
    * to the system 'move cursor'
 * @param e the event
 */
public void mousePressed(MouseEvent e) {
    VisualizationViewer<?,?> vv = (VisualizationViewer<?,?>)e.getSource();
    boolean accepted = checkModifiers(e);
    down = e.getPoint();
    if(accepted) {
        vv.setCursor(cursor);
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:15,代码来源:ViewTranslatingGraphMousePlugin.java

示例12: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * check the modifiers. If accepted, use the mouse drag motion
 * to rotate the graph in the master view
 */
public void mouseDragged(MouseEvent e) {
    if(down == null) return;
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    boolean accepted = checkModifiers(e);
    if(accepted) {
        if(vv instanceof SatelliteVisualizationViewer) {
            VisualizationViewer vvMaster = 
                ((SatelliteVisualizationViewer)vv).getMaster();
            
            MutableTransformer modelTransformerMaster = 
            	vvMaster.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

            // rotate
            vv.setCursor(cursor);
            // I want to compute rotation based on the view coordinates of the
            // lens center in the satellite view.
            // translate the master view center to layout coords, then translate
            // that point to the satellite view's view coordinate system....
            Point2D center = vv.getRenderContext().getMultiLayerTransformer().transform(vvMaster.getRenderContext().getMultiLayerTransformer().inverseTransform(vvMaster.getCenter()));
            Point2D q = down;
            Point2D p = e.getPoint();
            Point2D v1 = new Point2D.Double(center.getX()-p.getX(), center.getY()-p.getY());
            Point2D v2 = new Point2D.Double(center.getX()-q.getX(), center.getY()-q.getY());
            double theta = angleBetween(v1, v2);
            modelTransformerMaster.rotate(-theta, 
                    vvMaster.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, vvMaster.getCenter()));
            down.x = e.getX();
            down.y = e.getY();
        } 
        e.consume();
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:37,代码来源:SatelliteRotatingGraphMousePlugin.java

示例13: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
    * Check the event modifiers. Set the 'down' point for later
    * use. If this event satisfies the modifiers, change the cursor
    * to the system 'move cursor'
 * @param e the event
 */
public void mousePressed(MouseEvent e) {
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    boolean accepted = checkModifiers(e);
    down = e.getPoint();
    if(accepted) {
        vv.setCursor(cursor);
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:15,代码来源:TranslatingGraphMousePlugin.java

示例14: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * 
 * @param e the event
 */
public void mousePressed(MouseEvent e) {
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    boolean accepted = checkModifiers(e);
    down = e.getPoint();
    if(accepted) {
        vv.setCursor(cursor);
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:13,代码来源:ShearingGraphMousePlugin.java

示例15: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
* 
* 
* 
* 
*/
  public void mouseDragged(MouseEvent e) {
      if(down == null) return;
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer = 
          	vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          vv.setCursor(cursor);
          Point2D q = down;
          Point2D p = e.getPoint();
          float dx = (float) (p.getX()-q.getX());
          float dy = (float) (p.getY()-q.getY());

          Dimension d = vv.getSize();
          float shx = 2.f*dx/d.height;
          float shy = 2.f*dy/d.width;
          Point2D center = vv.getCenter();
          if(p.getX() < center.getX()) {
              shy = -shy;
          }
          if(p.getY() < center.getY()) {
              shx = -shx;
          }
          modelTransformer.shear(shx, shy, center);
          down.x = e.getX();
          down.y = e.getY();
      
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:37,代码来源:ShearingGraphMousePlugin.java


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