VisualizationViewer.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:BfROpenLab 作者:
/**
 * a setter for the GraphMouse. This will remove any
 * previous GraphMouse (including the one that
 * is added in the initMouseClicker method.
 * @param graphMouse new value
 */
public void setGraphMouse(GraphMouse graphMouse) {
    this.graphMouse = graphMouse;
    MouseListener[] ml = getMouseListeners();
    for(int i=0; i<ml.length; i++) {
        if(ml[i] instanceof GraphMouse) {
            removeMouseListener(ml[i]);
        }
    }
    MouseMotionListener[] mml = getMouseMotionListeners();
    for(int i=0; i<mml.length; i++) {
        if(mml[i] instanceof GraphMouse) {
            removeMouseMotionListener(mml[i]);
        }
    }
    MouseWheelListener[] mwl = getMouseWheelListeners();
    for(int i=0; i<mwl.length; i++) {
        if(mwl[i] instanceof GraphMouse) {
            removeMouseWheelListener(mwl[i]);
        }
    }
    addMouseListener(graphMouse);
    addMouseMotionListener(graphMouse);
    addMouseWheelListener(graphMouse);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号