當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。