本文整理匯總了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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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));
}
}
示例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());
}
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}