• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EditingModalGraphMouse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中edu.uci.ics.jung.visualization.control.EditingModalGraphMouse的典型用法代码示例。如果您正苦于以下问题:Java EditingModalGraphMouse类的具体用法?Java EditingModalGraphMouse怎么用?Java EditingModalGraphMouse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EditingModalGraphMouse类属于edu.uci.ics.jung.visualization.control包,在下文中一共展示了EditingModalGraphMouse类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getJComboBox

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
 * This method initializes jComboBox	
 * 	
 * @return javax.swing.JComboBox	
 */
private JComboBox getJComboBox() {
	if (jComboBox == null) {
		EditingModalGraphMouse<?, ?> gm = getBrowser().getMouse();
		gm.getModeComboBox().setSelectedIndex(0);
		jComboBox = gm.getModeComboBox();
	}
	return jComboBox;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:14,代码来源:MousePanel.java


示例2: addMouse

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
private void addMouse() {
	mouse = new EditingModalGraphMouse( view.getRenderContext(), vfac, efac );

	mouse.remove( mouse.getPopupEditingPlugin() );
	mouse.add( new MousePopuper() );

	mouse.remove( mouse.getEditingPlugin() );
	mouse.add( new QueryGraphMousePlugin<>( vfac, efac ) );

	view.setGraphMouse( mouse );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:12,代码来源:GraphicalQueryPanel.java


示例3: centerGraph

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
 * This method finds the location of the graph relative to the viewer and
 * shifts is so that it appears in the center of JUNG's VisualizationViewer.
 */
public static Point2D centerGraph(VisualizationViewer<Vertex, Edge> vv, BrowsableNetwork network, Layout<Vertex, Edge> layout,
		EditingModalGraphMouse<Vertex, Edge> mouse) {

	MutableTransformer layout2 = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
	double top = Double.MAX_VALUE;
	double bottom = Double.MAX_VALUE;
	double left = Double.MAX_VALUE;
	double right = Double.MAX_VALUE;

	for (Vertex v : network.getVertices()) {
		Point2D p;
		if (layout instanceof AbstractLayout)
			p = ((AbstractLayout<Vertex, Edge>) layout).transform(v);
		else
			p = ((TreeLayout<Vertex, Edge>) layout).transform(v);
		Point2D invP = layout2.transform(p);
		if (top < invP.getY() || top == Double.MAX_VALUE)
			top = invP.getY();
		if (bottom > invP.getY() || bottom == Double.MAX_VALUE)
			bottom = invP.getY();
		if (left > invP.getX() || left == Double.MAX_VALUE)
			left = invP.getX();
		if (right < invP.getX() || right == Double.MAX_VALUE)
			right = invP.getX();
	}
	if (mouse != null) {
		double scale = 0;
		do {
			scale = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).getScale();
			mouse.mouseWheelMoved(new MouseWheelEvent(vv, 0, 0, 0, vv.getWidth() / 2, vv.getHeight() / 2, 1, false, 1, -1, -1));
		} while (scale >= 1);
	}
	vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)
			.setScale(1, 1, new Point((int) (vv.getCenter().getX() - (right + left) / 2), (int) (vv.getCenter().getY() - (top + bottom) / 2)));

	double deltaX = vv.getCenter().getX() - (right + left) / 2;
	double deltaY = vv.getCenter().getY() - (top + bottom) / 2;
	if (!Double.isInfinite(deltaX) && !Double.isInfinite(deltaY) && !Double.isNaN(deltaX) && !Double.isNaN(deltaY)) {
		layout2.translate(deltaX, deltaY);
	}

	return vv.getCenter();
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:48,代码来源:NetworkPanel.java


示例4: main

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
     * @param args the command line arguments
     */
    public static void main(String[] args) {        
        JFrame frame = new JFrame("Editing and Mouse Menu Demo");
        SparseMultigraph<GraphElements.MyVertex, GraphElements.MyEdge> g = 
                new SparseMultigraph<GraphElements.MyVertex, GraphElements.MyEdge>();
        // Layout<V, E>, VisualizationViewer<V,E>
//        Map<GraphElements.MyVertex,Point2D> vertexLocations = new HashMap<GraphElements.MyVertex, Point2D>();
        Layout<GraphElements.MyVertex, GraphElements.MyEdge> layout = new StaticLayout(g);
        layout.setSize(new Dimension(300,300));
        VisualizationViewer<GraphElements.MyVertex,GraphElements.MyEdge> vv = 
                new VisualizationViewer<GraphElements.MyVertex,GraphElements.MyEdge>(layout);
        vv.setPreferredSize(new Dimension(350,350));
        // Show vertex and edge labels
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
        // Create a graph mouse and add it to the visualization viewer
        EditingModalGraphMouse gm = new EditingModalGraphMouse(vv.getRenderContext(), 
                 GraphElements.MyVertexFactory.getInstance(),
                GraphElements.MyEdgeFactory.getInstance()); 
        // Set some defaults for the Edges...
        GraphElements.MyEdgeFactory.setDefaultCapacity(192.0);
        GraphElements.MyEdgeFactory.setDefaultWeight(5.0);
        // Trying out our new popup menu mouse plugin...
        PopupVertexEdgeMenuMousePlugin myPlugin = new PopupVertexEdgeMenuMousePlugin();
        // Add some popup menus for the edges and vertices to our mouse plugin.
        JPopupMenu edgeMenu = new MyMouseMenus.EdgeMenu(frame);
        JPopupMenu vertexMenu = new MyMouseMenus.VertexMenu();
        myPlugin.setEdgePopup(edgeMenu);
        myPlugin.setVertexPopup(vertexMenu);
        gm.remove(gm.getPopupEditingPlugin());  // Removes the existing popup editing plugin
        
        gm.add(myPlugin);   // Add our new plugin to the mouse
        
        vv.setGraphMouse(gm);

        
        //JFrame frame = new JFrame("Editing and Mouse Menu Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(vv);
        
        // Let's add a menu for changing mouse modes
        JMenuBar menuBar = new JMenuBar();
        JMenu modeMenu = gm.getModeMenu();
        modeMenu.setText("Mouse Mode");
        modeMenu.setIcon(null); // I'm using this in a main menu
        modeMenu.setPreferredSize(new Dimension(80,20)); // Change the size so I can see the text
        
        menuBar.add(modeMenu);
        frame.setJMenuBar(menuBar);
        gm.setMode(ModalGraphMouse.Mode.EDITING); // Start off in editing mode
        frame.pack();
        frame.setVisible(true);    
    }
 
开发者ID:ksotala,项目名称:BayesGame,代码行数:56,代码来源:EditorMouseMenu.java


示例5: getMouse

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
 * Getter for the graph mouse associated to the panel
 * @return EditingModalGraphMouse automatically created by JUNG2.0
 */
public EditingModalGraphMouse<Vertex, Edge> getMouse();
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:6,代码来源:INetworkBrowser.java


示例6: getMouse

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
 * Getter for the graph mouse associated to the panel
 * 
 * @return EditingModalGraphMouse automatically created by JUNG2.0
 */
public EditingModalGraphMouse<Vertex, Edge> getMouse() {
	return graphMouse;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:9,代码来源:NetworkPanel.java


示例7: getMouse

import edu.uci.ics.jung.visualization.control.EditingModalGraphMouse; //导入依赖的package包/类
/**
 * Getter for the graph mouse associated to the panel
 * @return EditingModalGraphMouse automatically created by JUNG2.0
 */
public EditingModalGraphMouse<Vertex, Edge> getMouse(){
	return graphMouse;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:8,代码来源:CuttlefishPanel.java



注:本文中的edu.uci.ics.jung.visualization.control.EditingModalGraphMouse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Selector类代码示例发布时间:2022-05-23
下一篇:
Java AccessibilityActionCompat类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap