📄 abstractmanipulator.java
字号:
package net.sourceforge.jpowergraph.manipulator;
import net.sourceforge.jpowergraph.pane.JGraphPane;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
/**
* A utility abstract class providing default implementation of listener methods.
*/
public class AbstractManipulator implements Manipulator {
/** The graph pane. */
protected JGraphPane m_graphPane;
/** The screen point of the last mouse event. */
protected Point m_lastMouseEventScreenPoint;
public void setGraphPane(JGraphPane graphPane) {
m_graphPane=graphPane;
}
public void notifyGraphPaneScrolled() {
}
protected void updateLastMouseEventScreenPoint(MouseEvent e) {
m_lastMouseEventScreenPoint = m_graphPane.toDisplay(0, 0);
m_lastMouseEventScreenPoint.x += e.x;
m_lastMouseEventScreenPoint.y += e.y;
}
protected Point getLastMouseEventPoint() {
Point point = m_graphPane.toDisplay(0, 0);
point.x = m_lastMouseEventScreenPoint.x - point.x;
point.y = m_lastMouseEventScreenPoint.y - point.y;
return point;
}
protected void autoscroll(MouseEvent e) {
if (!m_graphPane.getClientArea().contains(e.x,e.y)){
m_graphPane.scrollRectToVisible(new Rectangle(e.x,e.y,300,300));
}
}
public String getName() {
return null;
}
public void paint(GC g) {}
public void mouseDoubleClick(MouseEvent arg0) {}
public void mouseDown(MouseEvent arg0) {}
public void mouseUp(MouseEvent arg0) {}
public void mouseEnter(MouseEvent arg0) {}
public void mouseExit(MouseEvent arg0) {}
public void mouseHover(MouseEvent arg0) {}
public void mouseMove(MouseEvent arg0) {}
public void keyPressed(KeyEvent arg0) {}
public void keyReleased(KeyEvent arg0) {}
public void focusGained(FocusEvent arg0) {}
public void focusLost(FocusEvent arg0) {}
public void dispose() {}
public boolean isDisposed() {
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -