List of usage examples for java.awt BasicStroke CAP_BUTT
int CAP_BUTT
To view the source code for java.awt BasicStroke CAP_BUTT.
Click Source Link
From source file:ca.nengo.plot.impl.DefaultPlotter.java
/** * @see ca.nengo.plot.Plotter#doPlot(ca.nengo.util.TimeSeries, ca.nengo.util.TimeSeries, java.lang.String) *//*from w w w .ja v a 2 s . c om*/ public void doPlot(TimeSeries ideal, TimeSeries actual, String title) { XYSeriesCollection idealDataset = getDataset(ideal); XYSeriesCollection actualDataset = getDataset(actual); JFreeChart chart = ChartFactory.createXYLineChart(title, "Time (s)", "", idealDataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDataset(1, actualDataset); XYLineAndShapeRenderer idealRenderer = new XYLineAndShapeRenderer(true, false); idealRenderer.setDrawSeriesLineAsPath(true); idealRenderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10f, new float[] { 10f, 10f }, 0f)); plot.setRenderer(plot.indexOf(idealDataset), idealRenderer); XYLineAndShapeRenderer actualRenderer = new XYLineAndShapeRenderer(true, false); actualRenderer.setDrawSeriesLineAsPath(true); //idealRenderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10f, new float[]{10f, 10f}, 0f)); plot.setRenderer(plot.indexOf(actualDataset), actualRenderer); showChart(chart, "Time Series Plot"); }
From source file:ancat.visualizers.EdgeTransformers.java
/** * Configuration of the Stroke used for drawing edges. It processes the * following values:/*from w w w.j a va2 s . co m*/ * * <code> edge:style </code> may be set to solid, dashed or dotted. By default * the edge style is set to dashed. * * <code> edge:stroke-width </code> The width of the stroke used for * rendering. * * <code> edge:dash-pattern</code> Contains an array of float values * describing the dash pattern. See documentation of Java Stroke class to * understand the pattern style</code> */ protected void setupStroke() { String style = "solid"; float width = 0.5f; float dash[] = null; Map<String, String> edgeConfig = _renderConfig.edgeConfiguration(); if (edgeConfig.containsKey("edge:style")) { style = edgeConfig.get("edge:style"); if (!style.equalsIgnoreCase("solid") && !style.equalsIgnoreCase("dashed") && !style.equalsIgnoreCase("dotted")) { _logger.error("unsupported edge style attribute: " + style + " allowed is solid, dashed, dotted"); style = "solid"; } } if (edgeConfig.containsKey("edge:stroke-width")) { try { width = Float.parseFloat(edgeConfig.get("edge:stroke-width")); } catch (Exception e) { _logger.error("unsupported specification of float value for edge width, changing to default"); } } if (edgeConfig.containsKey("edge:dash-pattern")) { try { StringTokenizer tokenizer = new StringTokenizer(edgeConfig.get("edge:dash-pattern"), ","); dash = new float[tokenizer.countTokens()]; int counter = 0; while (tokenizer.hasMoreElements()) { dash[counter] = Float.parseFloat(tokenizer.nextToken().trim()); counter += 1; } } catch (Exception e) { _logger.error("Error while parsing dash style, changing to default"); dash = new float[] { 10.0f }; } } if (style.equalsIgnoreCase("dashed")) { _edgeStroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); } else if (style.equalsIgnoreCase("dotted")) { dash = new float[] { 2.0f, 2.0f }; _edgeStroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); } else if (style.equalsIgnoreCase("solid")) { _edgeStroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); } }
From source file:net.sf.maltcms.chromaui.foldChangeViewer.tasks.FoldChangeViewLoaderWorker.java
@Override public void run() { ProgressHandle handle = ProgressHandleFactory.createHandle("Creating fold change plot"); try {// w w w .ja va 2 s . c o m handle.setDisplayName("Loading fold change elements");//+new File(this.files.getResourceLocation()).getName()); handle.start(5); handle.progress("Reading settings", 1); RTUnit rtAxisUnit = RTUnit.valueOf(sp.getProperty("rtAxisUnit", "SECONDS")); handle.progress("Retrieving data", 2); XYShapeRenderer renderer = new XYShapeRenderer() { @Override protected Paint getPaint(XYDataset dataset, int series, int item) { double x = dataset.getXValue(series, item); double y = dataset.getYValue(series, item); if (Math.abs(x) < 1.0) { Paint p = super.getPaint(dataset, series, item); if (p instanceof Color) { Color color = (Color) p; float[] values = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]); Color hsb = new Color( Color.HSBtoRGB(values[0], (float) Math.max(0.1, values[1] - 0.9), values[2])); return new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue(), 64); } } return super.getPaint(dataset, series, item); } }; renderer.setAutoPopulateSeriesFillPaint(true); renderer.setAutoPopulateSeriesOutlinePaint(true); renderer.setBaseCreateEntities(true); handle.progress("Building plot", 3); XYPlot plot = new XYPlot(dataset, new NumberAxis("log2 fold change"), new NumberAxis("-log10 p-value"), renderer); BasicStroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] { 5.0f }, 0.0f); ValueMarker marker = new ValueMarker(-Math.log10(0.05), Color.RED, dashed); marker.setLabel("p-value=0.05"); marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); marker.setLabelOffset(new RectangleInsets(UnitType.ABSOLUTE, 0, 50, 10, 0)); marker.setLabelOffsetType(LengthAdjustmentType.EXPAND); marker.setLabelPaint(Color.LIGHT_GRAY); plot.addRangeMarker(marker); Font font1 = new Font("SansSerif", Font.PLAIN, 12); SelectionAwareXYTooltipGenerator tooltipGenerator = cvtc.getLookup() .lookup(SelectionAwareXYTooltipGenerator.class); if (tooltipGenerator == null) { tooltipGenerator = new SelectionAwareXYTooltipGenerator(tooltipGenerator) { @Override public String createSelectionAwareTooltip(XYDataset xyd, int i, int i1) { FoldChangeDataset dataset = (FoldChangeDataset) xyd; FoldChangeElement fce = dataset.getNamedElementProvider().get(i).get(i1); StringBuilder sb = new StringBuilder(); sb.append("<html>"); sb.append(fce.getPeakGroup().getMajorityDisplayName()); sb.append("<br>"); sb.append("log2 fold change="); sb.append(fce.getFoldChange()); sb.append("<br>"); sb.append("p-value="); sb.append(Math.pow(10, -fce.getPvalue())); sb.append("</html>"); return sb.toString(); } }; } tooltipGenerator.setXYToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset xyd, int i, int i1) { Comparable comp = xyd.getSeriesKey(i); double x = xyd.getXValue(i, i1); double y = xyd.getYValue(i, i1); StringBuilder sb = new StringBuilder(); sb.append("<html>"); sb.append(comp); sb.append("<br>"); sb.append("log2 fold change="); sb.append(x); sb.append("<br>"); sb.append("p-value="); sb.append(sb.append(Math.pow(10, -y))); sb.append("</html>"); return sb.toString(); } }); plot.getRenderer().setBaseToolTipGenerator(tooltipGenerator); handle.progress("Configuring plot", 4); configurePlot(plot, rtAxisUnit); final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class); Range domainRange = null; Range valueRange = null; if (cmhp != null) { XYPlot xyplot = cmhp.getPlot(); if (xyplot != null) { ValueAxis domain = xyplot.getDomainAxis(); domainRange = domain.getRange(); ValueAxis range = xyplot.getRangeAxis(); valueRange = range.getRange(); } } if (domainRange != null) { plot.getDomainAxis().setRange(domainRange); } if (valueRange != null) { Logger.getLogger(getClass().getName()).info("Setting previous value range!"); } handle.progress("Adding plot to panel", 5); final XYPlot targetPlot = plot; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class); cmhp.setPlot(targetPlot); cvtc.requestActive(); } }); } finally { handle.finish(); } }
From source file:org.trade.ui.chart.CandlestickChart.java
/** * A demonstration application showing a candlestick chart. * /*from w ww. j ava 2s .co m*/ * @param title * the frame title. * @param strategyData * StrategyData */ public CandlestickChart(final String title, StrategyData strategyData, Tradingday tradingday) { this.strategyData = strategyData; this.setLayout(new BorderLayout()); // Used to mark the current price stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 10, 3 }, 0); valueMarker = new ValueMarker(0.00, Color.black, stroke); this.chart = createChart(this.strategyData, title, tradingday); BlockContainer container = new BlockContainer(new BorderArrangement()); container.add(titleLegend1, RectangleEdge.LEFT); container.add(titleLegend2, RectangleEdge.RIGHT); container.add(new EmptyBlock(2000, 0)); CompositeTitle legends = new CompositeTitle(container); legends.setPosition(RectangleEdge.BOTTOM); this.chart.addSubtitle(legends); final ChartPanel chartPanel = new ChartPanel(this.chart); chartPanel.setFillZoomRectangle(true); chartPanel.setMouseZoomable(true, true); chartPanel.setRefreshBuffer(true); chartPanel.setDoubleBuffered(true); chartPanel.setVerticalAxisTrace(true); chartPanel.setHorizontalAxisTrace(true); chartPanel.addChartMouseListener(new ChartMouseListener() { public void chartMouseMoved(ChartMouseEvent e) { } public void chartMouseClicked(final ChartMouseEvent e) { CombinedDomainXYPlot combinedXYplot = (CombinedDomainXYPlot) e.getChart().getPlot(); @SuppressWarnings("unchecked") List<XYPlot> subplots = combinedXYplot.getSubplots(); if (e.getTrigger().getClickCount() == 2) { double xItem = 0; double yItem = 0; if (e.getEntity() instanceof XYItemEntity) { XYItemEntity xYItemEntity = ((XYItemEntity) e.getEntity()); xItem = xYItemEntity.getDataset().getXValue(xYItemEntity.getSeriesIndex(), xYItemEntity.getItem()); yItem = xYItemEntity.getDataset().getYValue(xYItemEntity.getSeriesIndex(), xYItemEntity.getItem()); } else { PlotEntity plotEntity = ((PlotEntity) e.getEntity()); XYPlot plot = (XYPlot) plotEntity.getPlot(); xItem = plot.getDomainCrosshairValue(); yItem = plot.getRangeCrosshairValue(); } for (XYPlot xyplot : subplots) { double x = xyplot.getDomainCrosshairValue(); double y = xyplot.getRangeCrosshairValue(); /* * If the cross hair is from a right-hand y axis we need * to convert this to a left-hand y axis. */ String rightAxisName = ", Price: "; double rangeLowerLeft = 0; double rangeUpperLeft = 0; double rangeLowerRight = 0; double rangeUpperRight = 0; double yRightLocation = 0; for (int index = 0; index < xyplot.getRangeAxisCount(); index++) { AxisLocation axisLocation = xyplot.getRangeAxisLocation(index); Range range = xyplot.getRangeAxis(index).getRange(); if (axisLocation.equals(AxisLocation.BOTTOM_OR_LEFT) || axisLocation.equals(AxisLocation.TOP_OR_LEFT)) { rangeLowerLeft = range.getLowerBound(); rangeUpperLeft = range.getUpperBound(); rightAxisName = ", " + xyplot.getRangeAxis(index).getLabel() + ": "; } if (y >= range.getLowerBound() && y <= range.getUpperBound() && (axisLocation.equals(AxisLocation.BOTTOM_OR_RIGHT) || axisLocation.equals(AxisLocation.TOP_OR_RIGHT))) { rangeUpperRight = range.getUpperBound(); rangeLowerRight = range.getLowerBound(); } } if ((rangeUpperRight - rangeLowerRight) > 0) { yRightLocation = rangeLowerLeft + ((rangeUpperLeft - rangeLowerLeft) * ((y - rangeLowerRight) / (rangeUpperRight - rangeLowerRight))); } else { yRightLocation = y; } String text = " Time: " + dateFormatShort.format(new Date((long) (x))) + rightAxisName + new Money(y); if (x == xItem && y == yItem) { titleLegend1.setText(text); if (null == clickCrossHairs) { clickCrossHairs = new XYTextAnnotation(text, x, yRightLocation); clickCrossHairs.setTextAnchor(TextAnchor.BOTTOM_LEFT); xyplot.addAnnotation(clickCrossHairs); } else { clickCrossHairs.setText(text); clickCrossHairs.setX(x); clickCrossHairs.setY(yRightLocation); } } } } else if (e.getTrigger().getClickCount() == 1 && null != clickCrossHairs) { for (XYPlot xyplot : subplots) { if (xyplot.removeAnnotation(clickCrossHairs)) { clickCrossHairs = null; titleLegend1.setText(" Time: 0, Price :0.0"); break; } } } } }); this.add(chartPanel, null); this.strategyData.getCandleDataset().getSeries(0).addChangeListener(this); }
From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java
/** * Creates a new application./*from w ww .j a va2s . co m*/ * * @param historyCount * the history count (in milliseconds). */ public MemoryUsagePanel(int historyCount, int interval) { super(new BorderLayout()); // create two series that automatically discard data more than 30 // seconds old... this.total = new TimeSeries("Total Memory", Millisecond.class); this.total.setMaximumItemCount(historyCount); this.free = new TimeSeries("Free Memory", Millisecond.class); this.free.setMaximumItemCount(historyCount); this.used = new TimeSeries("Used Memory", Millisecond.class); this.used.setMaximumItemCount(historyCount); this.max = new TimeSeries("Used Memory", Millisecond.class); this.max.setMaximumItemCount(historyCount); TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(this.total); dataset.addSeries(this.free); dataset.addSeries(this.used); dataset.addSeries(this.max); DateAxis domain = new DateAxis("Time"); NumberAxis range = new NumberAxis("Memory"); domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14)); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); renderer.setSeriesPaint(0, Color.red); renderer.setSeriesPaint(1, Color.green); renderer.setSeriesPaint(2, Color.black); renderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); XYPlot plot = new XYPlot(dataset, domain, range, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); domain.setAutoRange(true); domain.setLowerMargin(0.0); domain.setUpperMargin(0.0); domain.setTickLabelsVisible(true); range.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot, true); chart.setBackgroundPaint(Color.white); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(chartPanel); gen = new DataGenerator(interval); }
From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeTransformer.java
public Stroke getBasicStroke(final float d) { float[] dash = { d }; return new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); }
From source file:ega.projekt.graphDraw.DrawGraph.java
public static BasicVisualizationServer<Node, Edge> generatePanel(ega.projekt.graph.Graph dataGraph, int panelWidth, int panelHeight) { if (dataGraph.getEdges().isEmpty()) System.out.println("Error initializing graph"); DrawGraph graphView = new DrawGraph(dataGraph); Layout<Node, Edge> layout = new StaticLayout(graphView.drawGraph); for (Node n : graphView.drawGraph.getVertices()) { layout.setLocation(n, new java.awt.geom.Point2D.Double(n.getX(), n.getY())); }/*from w w w . j a v a 2 s . co m*/ layout.setSize(new Dimension(panelWidth, panelHeight)); BasicVisualizationServer<Node, Edge> vv = new BasicVisualizationServer<>(layout); vv.setPreferredSize(new Dimension(panelWidth, panelHeight)); Transformer<Node, Paint> vertexPaint = new Transformer<Node, Paint>() { public Paint transform(Node i) { return Color.GREEN; } }; final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Transformer<Edge, Stroke> edgeStrokeTransformer = new Transformer<Edge, Stroke>() { public Stroke transform(Edge e) { return edgeStroke; } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Node, Edge>()); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Edge, String>() { public String transform(Edge e) { return (e.getFlowString() + "/" + Integer.toString(e.getCapacity())); } }); vv.getRenderContext().setVertexLabelTransformer(new Transformer<Node, String>() { public String transform(Node n) { return (Integer.toString(n.getID())); } }); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); return vv; }
From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeTransformer.java
public Stroke getBasicStroke(final float[] dash) { return new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); }
From source file:net.automatalib.visualization.jung.JungGraphVisualizationProvider.java
protected static NodeVisualization createNodeVisualization(Map<String, String> props, int id) { String label = props.get(NodeAttrs.LABEL); if (label == null) { label = "v" + id; }//from ww w . j a v a 2 s.c om Color drawColor = getColor(props, "color", Color.BLACK); Color fillColor = getColor(props, "fillcolor", Color.WHITE); String shapeName = props.get(NodeAttrs.SHAPE); if (shapeName == null) { shapeName = "circle"; } ShapeLibrary shapeLib = ShapeLibrary.getInstance(); Shape shape = shapeLib.createShape(shapeName); if (shape == null) { System.err.println("Could not create shape " + shapeName); shape = shapeLib.createShape("circle"); } String[] styles = {}; String styleAttr = props.get("style"); if (styleAttr != null) { styles = styleAttr.toLowerCase().split(","); } List<String> styleList = Arrays.asList(styles); float penWidth = 1.0f; Stroke stroke; if (styleList.contains("bold")) { penWidth = 3.0f; } if (styleList.contains("dashed")) { float[] dash = { 10.0f }; stroke = new BasicStroke(penWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); } else if (styleList.contains("dotted")) { float[] dash = { penWidth, penWidth + 7.0f }; stroke = new BasicStroke(penWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); } else { stroke = new BasicStroke(penWidth); } return new NodeVisualization(label, drawColor, fillColor, shape, stroke); }
From source file:fungus.JungObserver.java
public JungObserver(String name) { this.name = name; this.hyphadataPid = Configuration.getPid(name + "." + PAR_HYPHADATA_PROTO); this.hyphalinkPid = Configuration.getPid(name + "." + PAR_HYPHALINK_PROTO); this.mycocastPid = Configuration.getPid(name + "." + PAR_MYCOCAST_PROTO); self = this;/*from www .ja va 2 s .c om*/ mainThread = Thread.currentThread(); graph = new DirectedSparseGraph<MycoNode, String>(); edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String> layout = new edu.uci.ics.jung.algorithms.layout.SpringLayout<MycoNode, String>( graph); layout.setSize(new Dimension(650, 650)); layout.setRepulsionRange(75); //layout.setForceMultiplier(0.75); layout.setStretch(0.85); Dimension preferredSize = new Dimension(650, 650); VisualizationModel<MycoNode, String> visualizationModel = new DefaultVisualizationModel<MycoNode, String>( layout, preferredSize); visualizer = new VisualizationViewer<MycoNode, String>(visualizationModel, preferredSize); visualizer.addGraphMouseListener(new InfoFrameVertexListener()); //visualizer = new BasicVisualizationServer<Node,String>(layout); //visualizer.setPreferredSize(new Dimension(650, 650)); Transformer<MycoNode, String> nodeLabeller = new Transformer<MycoNode, String>() { public String transform(MycoNode n) { return Long.toString(n.getID()); } }; final Shape biomassCircle = new Ellipse2D.Float(-2.5f, -2.5f, 5.0f, 5.0f); final Shape hyphaCircle = new Ellipse2D.Float(-5.0f, -5.0f, 10.0f, 10.0f); Transformer<MycoNode, Shape> shapeTransformer = new Transformer<MycoNode, Shape>() { public Shape transform(MycoNode n) { HyphaData data = n.getHyphaData(); if (data.isBiomass()) { return biomassCircle; } else { return hyphaCircle; } } }; Transformer<MycoNode, Paint> nodeFillRenderer = new Transformer<MycoNode, Paint>() { public Paint transform(MycoNode n) { HyphaData data = (HyphaData) n.getProtocol(hyphadataPid); if (!n.isUp()) { return Color.BLACK; } if (data.isBiomass()) { return Color.BLUE; } else if (data.isExtending()) { return Color.RED; } else if (data.isBranching()) { return Color.YELLOW; } else { return Color.GREEN; } } }; Transformer<MycoNode, Paint> nodeShapeRenderer = new Transformer<MycoNode, Paint>() { public Paint transform(MycoNode n) { HyphaData data = (HyphaData) n.getProtocol(hyphadataPid); if (data.isBiomass()) { return Color.BLUE; } else if (data.isExtending()) { return Color.RED; } else if (data.isBranching()) { return Color.YELLOW; } else { return Color.GREEN; } } }; final Stroke biomassStroke = new BasicStroke(0.25f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); final Stroke hyphalStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); Transformer<String, Stroke> edgeStrokeTransformer = new Transformer<String, Stroke>() { public Stroke transform(String s) { Pair<MycoNode> vertices = graph.getEndpoints(s); HyphaData firstData = vertices.getFirst().getHyphaData(); HyphaData secondData = vertices.getSecond().getHyphaData(); if (firstData.isHypha() && secondData.isHypha()) { return hyphalStroke; } else { return biomassStroke; } } }; visualizer.getRenderContext().setVertexFillPaintTransformer(nodeFillRenderer); visualizer.getRenderContext().setVertexShapeTransformer(shapeTransformer); visualizer.getRenderContext().setVertexLabelTransformer(nodeLabeller); visualizer.setVertexToolTipTransformer(new ToStringLabeller<MycoNode>()); visualizer.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = frame.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); //JScrollPane scrollPane = new JScrollPane(visualizer); //c.add(scrollPane); c.add(visualizer); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS)); JButton pauseButton = new JButton("pause"); ActionListener pauser = new ActionListener() { public void actionPerformed(ActionEvent e) { //e.consume(); synchronized (self) { stepBlocked = true; noBlock = false; //self.notifyAll(); } } }; pauseButton.addActionListener(pauser); JButton stepButton = new JButton("step"); ActionListener stepper = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Clicked!\n"); //e.consume(); synchronized (self) { stepBlocked = false; self.notifyAll(); } } }; stepButton.addActionListener(stepper); JButton runButton = new JButton("run"); ActionListener runner = new ActionListener() { public void actionPerformed(ActionEvent e) { //e.consume(); synchronized (self) { stepBlocked = false; noBlock = true; self.notifyAll(); } } }; runButton.addActionListener(runner); buttonPane.add(pauseButton); buttonPane.add(stepButton); buttonPane.add(runButton); c.add(buttonPane); frame.pack(); frame.setVisible(true); }