在JUNG中覆盖悬停方法

时间:2014-04-28 15:02:47

标签: java jung

我正在使用框架vl-jung模拟用于目录浏览的气泡GUI,现在我正在尝试覆盖悬停方法,这样当我将鼠标悬停在方块上时,它会绘制其他内容"添加其他节点& #34;我正在使用库中的demo

        public void hoverChanged(ObjectSceneEvent event, Object previousHoveredObject, Object newHoveredObject) {
        //System.out.println("hover" + Number);

        if (newHoveredObject instanceof Number) {
            hover = (Number) newHoveredObject;
            widget = findWidget(hover);
            task.schedule(750);
        } else {
            widget = null;
            hover = null;
            task.cancel();
            getSceneAnimator().animateForegroundColor(label, new Color(255, 255, 255, 0));
        }
    }

我尝试将第一次绘制的代码添加到方法中,但它无法正常工作

    Factory<Integer> edgeFactory = new Factory<Integer>() {
    int i = 0;
    public Integer create() {
        return i++;
    }
};

Forest<String, Integer> createTree(Forest<String, Integer> graph) {

    //graph.addVertex("A0");
    graph.addEdge(edgeFactory.create(), "MyComp", "B0");
    graph.addEdge(edgeFactory.create(), "MyComp", "B1");
    graph.addEdge(edgeFactory.create(), "MyComp", "B2");
}

0 个答案:

没有答案