本文整理汇总了Java中edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse.setMode方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultModalGraphMouse.setMode方法的具体用法?Java DefaultModalGraphMouse.setMode怎么用?Java DefaultModalGraphMouse.setMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse
的用法示例。
在下文中一共展示了DefaultModalGraphMouse.setMode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DerivationViewer
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public DerivationViewer(DerivationTree g, Dimension d, Color targetColor, AnchorType anchor) {
super(new CircleLayout<>(g));
anchorStyle = anchor;
DerivationTreeTransformer dtt = new DerivationTreeTransformer(g, d, false);
StaticLayout<Node, DerivationTreeEdge> derivationLayout = new StaticLayout<>(g, dtt);
// derivationLayout.setSize(dtt.getSize());
setGraphLayout(derivationLayout);
scaleToLayout(new LayoutScalingControl());
// g.addCorrespondences();
setPreferredSize(new Dimension(DEFAULT_HEIGHT, DEFAULT_WIDTH));
getRenderContext().setVertexLabelTransformer(new ToStringLabeller<>());
DefaultModalGraphMouse<Node, DerivationTreeEdge> graphMouse = new DefaultModalGraphMouse<>();
graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
setGraphMouse(graphMouse);
addKeyListener(graphMouse.getModeKeyListener());
// this.setPickedVertexState(new DerivationTreePickedState(g));
getRenderContext().setVertexFillPaintTransformer(vp);
getRenderContext().setEdgeStrokeTransformer(es);
getRenderContext().setVertexShapeTransformer(ns);
getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
TGT = targetColor;
anchorPoint = dtt.getAnchorPosition(anchorStyle);
}
示例2: StateVisualizer
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public StateVisualizer() {
super("Model Visualizer");
graph = new DirectedSparseMultigraph<>();
graph.addVertex(current);
// Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
layout = new KKLayout<>(graph);
layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
vv = new VisualizationViewer<>(layout);
vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
// vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
// vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
vv.addKeyListener(gm.getModeKeyListener());
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
getContentPane().add(vv);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1024, 768);
pack();
setVisible(true);
}
示例3: FSMBuildVisualizer
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public FSMBuildVisualizer() {
super("Model Visualizer");
graph = new DirectedSparseMultigraph<>();
graph.addVertex(current);
// Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
layout = new KKLayout<>(graph);
layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
vv = new VisualizationViewer<>(layout);
vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
// vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
// vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
vv.addKeyListener(gm.getModeKeyListener());
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
getContentPane().add(vv);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1024, 768);
pack();
setVisible(true);
}
示例4: applyStyles
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public static <V, E> void applyStyles(final VisualizationViewer<V, E> visualizationViewer) {
final RenderContext<V, E> renderContext = visualizationViewer.getRenderContext();
renderContext.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM, false));
renderContext.setEdgeStrokeTransformer(input -> stroke);
renderContext.setEdgeDrawPaintTransformer(input -> WidgetUtils.BG_COLOR_LESS_BRIGHT);
renderContext.setVertexLabelRenderer(new DefaultVertexLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM));
renderContext.setEdgeFontTransformer(GraphUtils.createFontTransformer());
renderContext.setVertexFontTransformer(GraphUtils.createFontTransformer());
final DefaultModalGraphMouse<Object, Integer> graphMouse = new DefaultModalGraphMouse<Object, Integer>() {
@Override
public void mouseWheelMoved(final MouseWheelEvent e) {
// avoid zooming
return;
}
};
graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
graphMouse.setZoomAtMouse(false);
visualizationViewer.setGraphMouse(graphMouse);
}
示例5: visualizeGraph
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public static <V, E> void visualizeGraph(Graph<V,E> g) {
Layout<Integer, String> layout = new KKLayout(g);
layout.setSize(new Dimension(800,800)); // sets the initial size of the layout space
// The BasicVisualizationServer<V,E> is parameterized by the vertex and edge types
VisualizationViewer<Integer,String> vv = new VisualizationViewer<Integer,String>(layout);
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
gm.setMode(DefaultModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.setPreferredSize(new Dimension(800,800)); //Sets the viewing area size
JFrame frame = new JFrame("Simple Graph View");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);
}
示例6: main
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public static void main(String[] args) {
DirectedSparseGraph<String, String> g = new DirectedSparseGraph<String, String>();
g.addVertex("Square");
g.addVertex("Rectangle");
g.addVertex("Circle");
g.addEdge("Edge1", "Square", "Rectangle");
g.addEdge("Edge2", "Square", "Circle");
g.addEdge("Edge3", "Circle", "Square");
VisualizationViewer<String, String> vv =
new VisualizationViewer<String, String>(
new FRLayout<String, String>(g), new Dimension(400,400));
Transformer<String, String> transformer = new Transformer<String, String>() {
@Override public String transform(String arg0) { return arg0; }
};
vv.getRenderContext().setVertexLabelTransformer(transformer);
transformer = new Transformer<String, String>() {
@Override public String transform(String arg0) { return arg0; }
};
vv.getRenderContext().setEdgeLabelTransformer(transformer);
vv.getRenderer().setVertexRenderer(new MyRenderer());
// The following code adds capability for mouse picking of vertices/edges. Vertices can even be moved!
final DefaultModalGraphMouse<String,Number> graphMouse = new DefaultModalGraphMouse<String,Number>();
vv.setGraphMouse(graphMouse);
graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
JFrame frame = new JFrame();
frame.getContentPane().add(vv);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
示例7: createWindow
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
private JFrame createWindow(final VisualizationViewer<Node, Edge> viewer, final String name) {
viewer.setBackground(Color.WHITE);
final DefaultModalGraphMouse<Node, Edge> gm = new DefaultModalGraphMouse<Node, Edge>();
gm.setMode(DefaultModalGraphMouse.Mode.PICKING);
viewer.setGraphMouse(gm);
final JFrame frame = new JFrame(name + " viewer");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setLayout(new GridLayout());
frame.getContentPane().add(viewer);
frame.pack();
return frame;
}
示例8: createGraphComponent
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
private JComponent createGraphComponent() {
Graph<State, TransitionEdge> graph = new DirectedSparseGraph<>();
Layout<State, TransitionEdge> layout = new StaticLayout<>(graph, new ReachGraphInitializer(graph.getVertices()));
visualizationViewer = new VisualizationViewer<>(layout);
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
visualizationViewer.setGraphMouse(gm);
VertexLabelAsShapeRenderer<State, TransitionEdge> vertexRenderer = new VertexLabelAsShapeRenderer<>(visualizationViewer.getRenderContext());
// vertices
visualizationViewer.getRenderContext().setVertexLabelTransformer(state -> {
StringBuilder sb = new StringBuilder();
for (Integer token : state.getMarking().values()) {
sb.append(token == -1 ? "\u221E" : token).append(",");
}
if (sb.length() > 0) sb.setLength(sb.length() - 1);
return sb.toString();
});
visualizationViewer.getRenderContext().setVertexShapeTransformer(vertexRenderer);
visualizationViewer.getRenderContext().setVertexFillPaintTransformer(s -> {
if (!visualizationViewer.getPickedVertexState().getPicked().isEmpty())
return visualizationViewer.getPickedVertexState().isPicked(s) ? ACTIVE_VERTEX_FILL_COLOR : INACTIVE_VERTEX_FILL_COLOR;
return VERTEX_FILL_COLOR;
});
visualizationViewer.getRenderContext().setVertexFontTransformer(s -> FONT);
visualizationViewer.getRenderer().setVertexLabelRenderer(vertexRenderer);
// edges
visualizationViewer.getRenderContext().setEdgeLabelTransformer(transition -> "T" + transition.getTransition().getId());
visualizationViewer.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<>());
visualizationViewer.getRenderContext().setEdgeDrawPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setArrowDrawPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setArrowFillPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setEdgeFontTransformer(s -> FONT);
visualizationViewer.getRenderContext().getEdgeLabelRenderer().setRotateEdgeLabels(false);
ReachGraphEdgeLabelRenderer<State, TransitionEdge> reachGraphEdgeLabelRenderer = new ReachGraphEdgeLabelRenderer<>(this::getEdgeColor);
visualizationViewer.getRenderer().setEdgeLabelRenderer(reachGraphEdgeLabelRenderer);
visualizationViewer.setBackground(GRAPH_BACKGROUND);
addComponentListener(new AbstractResizeComponentListener() {
@Override
public void componentResized(ComponentEvent e) {
Dimension size = e.getComponent().getSize();
layout.setSize(size);
}
});
ReachGraphMouseListener graphMouseListener = new ReachGraphMouseListener(visualizationViewer, new StatePickedListener(graphService), this);
visualizationViewer.addMouseListener(graphMouseListener);
visualizationViewer.addGraphMouseListener(graphMouseListener);
return visualizationViewer;
}
示例9: CustomQueryView
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
/**
* Initializer
*
* @param inVdat VarData Object
*/
public CustomQueryView(VarData inVdat, VarSifter inGui) {
vdat = inVdat;
gui = inGui;
String[] origSampleNames = vdat.returnSampleNames(); // The original names - DON'T CHANGE THIS!!
sampleNames = new String[origSampleNames.length];
annotNames = vdat.returnDataNames();
dataTypeAt = vdat.returnDataTypeAt();
sampleIndexOf = new HashMap<String,Integer>(origSampleNames.length);
annoSize = dataTypeAt.size();
annotMap = vdat.returnAnnotMap();
for (int i=0; i<origSampleNames.length; i++) {
String n = origSampleNames[i];
sampleIndexOf.put(n, i);
sampleNames[i] = n;
}
graph = new DelegateForest<CustomVertex,Integer>();
layout = new TreeLayout<CustomVertex,Integer>(graph);
vv = new VisualizationViewer<CustomVertex,Integer>(layout);
VertexLabelAsShapeRenderer<CustomVertex,Integer> vlasr = new
VertexLabelAsShapeRenderer<CustomVertex,Integer>(vv.getRenderContext());
vv.getRenderContext().setVertexLabelTransformer(
new ChainedTransformer<CustomVertex,String>(new Transformer[]{
new ToStringLabeller<String>(),
new Transformer<String,String>() {
public String transform(String input) {
return "<html><center>"+input;
}
}
}));
vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderer().setVertexLabelRenderer(vlasr);
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
modeBox = graphMouse.getModeComboBox();
modeBox.setMaximumSize(modeBox.getPreferredSize());
modeBox.addItemListener(graphMouse.getModeListener());
graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
vv.setGraphMouse(graphMouse);
String out = "";
sampleList = new JList(sampleNames);
annotList = new JList(annotNames);
initQuery();
initTable();
}
示例10: JungVisualizationViewer
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public JungVisualizationViewer(GraphMatrixWrapper<N, E> graph, boolean showNodeLabels, boolean showEdgeLabels) {
super(graph.getGraphMatrix().getGUIObject());
this.graph = graph;
this.graphMatrix = graph.getGraphMatrix();
this.matrixGUIObject = (MatrixGUIObject) graphMatrix.getGUIObject();
this.showNodeLabels = showNodeLabels;
this.showEdgeLabels = showEdgeLabels;
if (graph.getVertexCount() < 1000) {
layout = new FRLayout<N, EdgeWrapper<E>>(graph);
} else {
layout = new ISOMLayout<N, EdgeWrapper<E>>(graph);
}
VisualizationModel<N, EdgeWrapper<E>> visualizationModel = new DefaultVisualizationModel<N, EdgeWrapper<E>>(
layout);
vv = new VisualizationViewer<N, EdgeWrapper<E>>(visualizationModel);
vv.setForeground(new Color(0, 0, 0, 150));
vv.setBackground(Color.WHITE);
DefaultModalGraphMouse<N, E> graphMouse = new DefaultModalGraphMouse<N, E>();
vv.setGraphMouse(graphMouse);
graphMouse.setMode(Mode.PICKING);
RenderContext<N, EdgeWrapper<E>> rc = vv.getRenderContext();
emptyNodeLabelTransformer = rc.getVertexLabelTransformer();
emptyEdgeLabelTransformer = rc.getEdgeLabelTransformer();
rc.setVertexIconTransformer(new VertexIconTransformer<N>(vv.getPickedVertexState()));
rc.setVertexFillPaintTransformer(new ColorTransformer<N>(vv.getPickedVertexState()));
rc.setVertexLabelRenderer(new DefaultVertexLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setEdgeDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setArrowFillPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setArrowDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);
if (showNodeLabels) {
rc.setVertexLabelTransformer(new ToStringLabeller<N>());
}
if (showEdgeLabels) {
rc.setEdgeLabelTransformer(new ToStringLabeller<EdgeWrapper<E>>());
}
vv.setVertexToolTipTransformer(new ToStringLabeller<N>());
setLayout(new BorderLayout());
add(vv, BorderLayout.CENTER);
vv.addMouseListener(this);
addComponentListener(this);
vv.addGraphMouseListener(this);
if (graph instanceof GraphMatrixWrapper) {
((MatrixGUIObject) ((GraphMatrixWrapper<N, E>) graph).getGraphMatrix().getGUIObject())
.addTableModelListener(this);
}
}
示例11: InitiateGraph
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
public void InitiateGraph(Character[] cs, Template[] templates, Color[] colors, String[] picture_keys,
String[] extra_keys) {
Map<CharacterNode, Icon> iconMap = new HashMap<CharacterNode, Icon>();
characters = new CharacterNode[cs.length];
for (int x = 0; x < cs.length; x++) {
characters[x] = new CharacterNode(cs[x]);
for (int y = 0; y < templates.length; y++) {
if (cs[x].templateIdentifier.equals(templates[y].GetTemplateID())) {
characters[x].color = colors[y];
characters[x].extra_key = extra_keys[y];
ImageIcon img = XEED.RescaleImageIcon((ImageIcon) cs[x].imgData.get(picture_keys[y]), ImageMaxSize,
ImageMaxSize);
if (img != null) {
iconMap.put(characters[x], new LayeredIcon(img.getImage()));
}
}
}
}
// creates the graph
graph = new DelegateForest<CharacterNode, Integer>();
//Loads the tree data
createTree();
//Sets up the transformer that paints the node.
Transformer<CharacterNode, Paint> vertexPaint = new Transformer<CharacterNode, Paint>() {
@Override
public Paint transform(CharacterNode cn) {
;
return cn.color;
}
};
final DefaultVertexIconTransformer<CharacterNode> vertexIconFunction = new DefaultVertexIconTransformer<CharacterNode>();
vertexIconFunction.setIconMap(iconMap);
final VertexIconShapeTransformer<CharacterNode> vertexImageShapeFunction = new VertexIconShapeTransformer<CharacterNode>(
new EllipseVertexShapeTransformer<CharacterNode>());
vertexImageShapeFunction.setIconMap(iconMap);
treeLayout = new TreeLayout<CharacterNode, Integer>(graph, TreeLayout.DEFAULT_DISTX * 3);
//Skriva en anpassad metod för att bestämma platser.
//använd treeLayout.setLocation();
vv = new VisualizationViewer<CharacterNode, Integer>(treeLayout);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
// add a listener for ToolTips
vv.setVertexToolTipTransformer(new ToStringLabeller());
vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO);
Container content = this;
final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
content.add(panel);
panel.setVisible(true);
content.validate();
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
vv.setGraphMouse(graphMouse);
graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
}
示例12: showFull
import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //导入方法依赖的package包/类
/**
* Show the full StateMachine with a special formater.
* <p/>
* @param <T> type of state machine
* @param stateMachine the statemachine to show
* @param formater an optional formater
*/
public static <T> void showFull(final StateMachine<T> stateMachine, final StateFormater<T> formater) {
DirectedGraph<State<T>, String> g = new DirectedSparseMultigraph<>();
int i = 0;
for (Link<T> link : stateMachine.getLinks()) {
// TODO: A Graph needs for each transition a unique id. A StateMachine not. So we build it here.
g.addEdge("[" + (i++) + "] " + link.getTransition().toString(), link.getSource(), link.getDestination());
}
FRLayout<State<T>, String> layout = new FRLayout<>(g);
// layout.setRepulsionMultiplier(2);
// layout.setMaxIterations(20);
layout.setSize(new Dimension(1100, 950)); // sets the initial size of the space
VisualizationViewer<State<T>, String> vv = new VisualizationViewer<>(layout);
vv.setPreferredSize(new Dimension(1280, 1024)); //Sets the viewing area size
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);
// final VisualizationModel<String,Number> visualizationModel =
// new DefaultVisualizationModel<String,Number>(layout, preferredSize);
// this class will provide both label drawing and vertex shapes
VertexLabelAsShapeRenderer<State<T>, String> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
//
// // customize the render context
if ( formater != null ) {
vv.getRenderContext().setVertexLabelTransformer((state) -> {
return formater.toHtml(state);
});
vv.setVertexToolTipTransformer((state) -> {
return formater.toToolTipHtml(state);
});
}
vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.RED));
vv.getRenderContext().setEdgeDrawPaintTransformer((input) -> {
return Color.DARK_GRAY;
});
vv.getRenderContext().setEdgeStrokeTransformer((input) -> {
return new BasicStroke(2.5f);
});
// customize the renderer
vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<State<T>, String>(Color.LIGHT_GRAY, Color.WHITE, true));
vv.getRenderer().setVertexLabelRenderer(vlasr);
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
vv.addKeyListener(gm.getModeKeyListener());
JFrame frame = new JFrame("Simple Graph View");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(vv, BorderLayout.CENTER);
frame.getContentPane().add(gm.getModeComboBox(), BorderLayout.SOUTH);
frame.pack();
frame.setVisible(true);
}