本文整理汇总了Java中prefuse.controls.FocusControl类的典型用法代码示例。如果您正苦于以下问题:Java FocusControl类的具体用法?Java FocusControl怎么用?Java FocusControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FocusControl类属于prefuse.controls包,在下文中一共展示了FocusControl类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: StackedGraphDisplay
import prefuse.controls.FocusControl; //导入依赖的package包/类
StackedGraphDisplay()
{
super( new Visualization() );
setBackground( ColorLib.getColor( 0, 51, 88 ) );
LabelRenderer labelRenderer = new LabelRenderer( NAME_LABEL );
labelRenderer.setVerticalAlignment( Constants.BOTTOM );
labelRenderer.setHorizontalAlignment( Constants.LEFT );
EdgeRenderer usesRenderer = new EdgeRenderer( Constants.EDGE_TYPE_CURVE, Constants.EDGE_ARROW_FORWARD );
usesRenderer.setHorizontalAlignment1( Constants.CENTER );
usesRenderer.setHorizontalAlignment2( Constants.CENTER );
usesRenderer.setVerticalAlignment1( Constants.BOTTOM );
usesRenderer.setVerticalAlignment2( Constants.TOP );
Predicate usesPredicate = (Predicate) ExpressionParser.parse( "ingroup('graph.edges') AND [" + USES_EDGES + "]==true", true );
// set up the renderers - one for nodes and one for LABELS
DefaultRendererFactory rf = new DefaultRendererFactory();
rf.add( new InGroupPredicate( GRAPH_NODES ), new NodeRenderer() );
rf.add( new InGroupPredicate( LABELS ), labelRenderer );
rf.add( usesPredicate, usesRenderer );
m_vis.setRendererFactory( rf );
// border colors
ColorAction borderColor = new BorderColorAction( GRAPH_NODES );
ColorAction fillColor = new FillColorAction( GRAPH_NODES );
// uses edge colors
ItemAction usesColor = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.STROKECOLOR, ColorLib.rgb( 50, 50, 50 ) );
ItemAction usesArrow = new ColorAction( GRAPH_EDGES, usesPredicate, VisualItem.FILLCOLOR, ColorLib.rgb( 50, 50, 50 ) );
// color settings
ActionList colors = new ActionList();
colors.add( fillColor );
colors.add( borderColor );
colors.add( usesColor );
colors.add( usesArrow );
m_vis.putAction( COLORS_ACTION, colors );
ActionList autoPan = new ActionList();
autoPan.add( colors );
autoPan.add( new AutoPanAction() );
autoPan.add( new RepaintAction() );
m_vis.putAction( AUTO_PAN_ACTION, autoPan );
// create the layout action list
stackedLayout = new StackedLayout( GRAPH );
ActionList layout = new ActionList();
layout.add( stackedLayout );
layout.add( new LabelLayout( LABELS ) );
layout.add( autoPan );
m_vis.putAction( LAYOUT_ACTION, layout );
// initialize our display
Dimension size = new Dimension( 400, 400 );
setSize( size );
setPreferredSize( size );
setItemSorter( new ExtendedTreeDepthItemSorter( true ) );
addControlListener( new HoverControl() );
addControlListener( new FocusControl( 1, COLORS_ACTION ) );
addControlListener( new WheelMouseControl() );
addControlListener( new PanControl( true ) );
addControlListener( new ItemSelectionControl() );
setDamageRedraw( true );
}
开发者ID:apache,项目名称:polygene-java,代码行数:69,代码来源:StackedGraphDisplay.java
注:本文中的prefuse.controls.FocusControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论