List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:Gui.admin.NouveauStatistique.java
private void StatistiquesBouttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StatistiquesBouttonActionPerformed int size = tablemesEvaluation.getRowCount(); List<Double> notes = new ArrayList<Double>(); List<Integer> ids = new ArrayList<Integer>(); List<String> noms = new ArrayList<String>(); EvaluationDAO evaluationDAO = new EvaluationDAO(); System.out.println("ouh ouh " + size); //System.out.println(evaluationDAO.getMoyenneByAdherent(8)); int idadh;/*w w w . ja v a2 s .c o m*/ float ess; for (int i = 0; i < size; i++) { System.out.println(tablemesEvaluation.getValueAt(i, 4).toString()); idadh = Integer.parseInt(tablemesEvaluation.getValueAt(i, 1).toString()); String nom = (tablemesEvaluation.getValueAt(i, 2).toString()); // notes.add((new Double (tablemesEvaluation.getValueAt(i,2).toString()))); System.out.println(" id adherent " + idadh); // System.out.println("moyenne "+); ess = evaluationDAO.getMoyenneByAdherent(idadh); System.out.println(ess); // notes.add((new Double (evaluationDAO.getMoyenneByAdherent((int) tablemesEvaluation.getValueAt(i,1))))); notes.add((new Double(ess))); ids.add((int) tablemesEvaluation.getValueAt(i, 1)); noms.add(nom); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < size; i++) { dataset.setValue(new Double(notes.get(i)), "notes", new String(noms.get(i))); } //dataset.setValue(evaluationTable); JFreeChart chart = ChartFactory.createBarChart3D("Notes Adhrents", "Noms des adhrents", "Notes", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.black); ChartFrame frame = new ChartFrame(" les notes des adhrents", chart); frame.setVisible(true); frame.setSize(700, 800); ValueMarker marker = new ValueMarker(15); marker.setLabel(" seuil de l'valuation "); marker.setLabelAnchor(RectangleAnchor.CENTER); marker.setPaint(Color.YELLOW); p.addRangeMarker(marker); p.setRangeGridlinePaint(Color.RED); try { } catch (Exception e) { } /* String note =noteTxt.getText(); String idAdherent=idAdherentEvaluText.getText(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(new Double(note), "notes", new Double(idAdherent)); //dataset.setValue(evaluationTable); JFreeChart chart = ChartFactory.createBarChart3D("Notes Adhrents", "Id Adhrents", "Notes", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p= chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.black); ChartFrame frame = new ChartFrame(" les notes des adhrents", chart); frame.setVisible(true); frame.setSize(450,350); */ try { final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final File file1 = new File("statistiques.png"); ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (Exception e) { } }
From source file:com.bdb.weather.display.freeplot.SummaryFreePlot.java
/** * Create the JFreeChart series for the wind values. * /*www . ja v a 2 s . c o m*/ * @param stroke The stroke for the series */ private List<FreePlotSeries<SummaryRecord>> createWindSeries(Stroke stroke) { List<FreePlotSeries<SummaryRecord>> list = new ArrayList<>(); int n = 0; list.add(new FreePlotSeries<>(AVG_WIND_SERIES_NAME, n++, Color.CYAN, stroke, SummaryRecord::getAvgWindSpeed, dateMethod, period)); list.add(new FreePlotSeries<>(MAX_WIND_SERIES_NAME, n++, Color.yellow, stroke, SummaryRecord::getMaxWindSpeed, dateMethod, period)); list.add(new FreePlotSeries<>(MAX_GUST_SERIES_NAME, n++, Color.yellow, stroke, SummaryRecord::getMaxWindGust, dateMethod, period)); return list; }
From source file:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java
/** * Actually draws the environment on the view. * // w w w .j av a2s. c o m * @param g * {@link Graphics2D} object responsible for drawing */ protected final void drawEnvOnView(final Graphics2D g) { if (wormhole == null || !isVisible() || !isEnabled()) { return; } accessData(); if (hooked.isPresent()) { final Position hcoor = positions.get(hooked.get()); final Point hp = wormhole.getViewPoint(hcoor); if (hp.distance(getCenter()) > FREEDOM_RADIUS) { wormhole.setViewPosition(hp); } } /* * Compute nodes in sight and their screen position */ final Map<Node<T>, Point> onView = positions.entrySet().parallelStream() .map(pair -> new Pair<>(pair.getKey(), wormhole.getViewPoint(pair.getValue()))) .filter(p -> wormhole.isInsideView(p.getSecond())) .collect(Collectors.toMap(Pair::getKey, Pair::getValue)); g.setColor(Color.BLACK); if (obstacles != null) { /* * TODO: only draw obstacles if on view */ obstacles.parallelStream().map(this::convertObstacle).forEachOrdered(g::fill); } if (paintLinks) { g.setColor(Color.GRAY); onView.keySet().parallelStream().map(neighbors::get) .flatMap(neigh -> neigh.getNeighbors().parallelStream() .map(node -> node.compareTo(neigh.getCenter()) > 0 ? new Pair<>(neigh.getCenter(), node) : new Pair<>(node, neigh.getCenter()))) .distinct().map( pair -> mapPair(pair, node -> Optional.ofNullable(onView.get(node)) .orElse(wormhole.getViewPoint(positions.get(node))))) .forEachOrdered(line -> { final Point p1 = line.getFirst(); final Point p2 = line.getSecond(); g.drawLine(p1.x, p1.y, p2.x, p2.y); }); } releaseData(); if (isDraggingMouse && status == ViewStatus.MOVING && originPoint.isPresent() && endingPoint.isPresent()) { for (final Node<T> n : selectedNodes) { if (onView.containsKey(n)) { onView.put(n, new Point(onView.get(n).x + (endingPoint.get().x - originPoint.get().x), onView.get(n).y + (endingPoint.get().y - originPoint.get().y))); } } } g.setColor(Color.GREEN); if (effectStack != null) { effectStack.forEach(effect -> { onView.entrySet().forEach(entry -> { final Point p = entry.getValue(); effect.apply(g, entry.getKey(), p.x, p.y); }); }); } if (isCloserNodeMarked()) { final Optional<Map.Entry<Node<T>, Point>> closest = onView.entrySet().parallelStream() .min((pair1, pair2) -> { final Point p1 = pair1.getValue(); final Point p2 = pair2.getValue(); final double d1 = Math.hypot(p1.x - mousex, p1.y - mousey); final double d2 = Math.hypot(p2.x - mousex, p2.y - mousey); return Double.compare(d1, d2); }); if (closest.isPresent()) { nearest = closest.get().getKey(); final int nearestx = closest.get().getValue().x; final int nearesty = closest.get().getValue().y; drawFriedEgg(g, nearestx, nearesty, Color.RED, Color.YELLOW); } } else { nearest = null; } if (isDraggingMouse && status == ViewStatus.SELECTING && originPoint.isPresent() && endingPoint.isPresent()) { g.setColor(Color.BLACK); final int x = originPoint.get().x < endingPoint.get().x ? originPoint.get().x : endingPoint.get().x; final int y = originPoint.get().y < endingPoint.get().y ? originPoint.get().y : endingPoint.get().y; final int width = Math.abs(endingPoint.get().x - originPoint.get().x); final int height = Math.abs(endingPoint.get().y - originPoint.get().y); g.drawRect(x, y, width, height); selectedNodes = onView.entrySet().parallelStream() .filter(nodes -> isInsideRectangle(nodes.getValue(), x, y, width, height)) .map(onScreen -> onScreen.getKey()).collect(Collectors.toSet()); } selectedNodes.parallelStream().map(e -> Optional.ofNullable(onView.get(e))).filter(Optional::isPresent) .map(Optional::get).forEachOrdered(p -> drawFriedEgg(g, p.x, p.y, Color.BLUE, Color.CYAN)); }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart./* w ww .j av a 2s. com*/ * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createXYLineSplineChart(String title, String categoryAxisLabel, String valueAxisLabel, XYDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createXYLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundAlpha(0.4f); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); plot.setRenderer(new XYSplineRenderer(100)); XYSplineRenderer renderer = (XYSplineRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:base.BasePlayer.AminoTable.java
void drawScreen(Graphics g) { if (!isEnabled()) { return;/* w ww . ja v a 2s . com*/ } buf.setColor(Color.black); buf.fillRect(0, 0, VariantHandler.tableScroll.getViewport().getWidth(), tablescroll.getViewport().getHeight()); if (VariantHandler.writetofile.isSelected()) { buf.setColor(Color.white); if (FileRead.output != null && Main.drawCanvas.loading && Draw.variantcalculator) { buf.drawString("Writing results to " + FileRead.outputName, 10, 20); } else { buf.drawString("Press annotate to write results straight to file", 10, 20); } g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null); return; } //Header Draw genemutcount = 0; hoverVar = null; hoverSample = -1; headerHover = -1; geneHeaderHover = -1; if (!mouseDrag) { resizeColumn = -1; } firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd - aminoarray.size(); if (firstrow < 0) { firstrow = 0; } for (int i = 0; i < genearray.size(); i++) { dot = false; if ((i + 1 + samplecount + aminoarray.size() + listAdd) * rowHeight < tablescroll.getVerticalScrollBar() .getValue()) { continue; } if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue() + tablescroll.getViewport().getHeight()) { break; } if (mouseY >= (rowHeight * (i + genemutcount + 1)) && mouseY < (rowHeight * (i + genemutcount + 2))) { hoverNode = genearray.get(i); } try { buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } textWidth = (int) fm.getStringBounds("" + (i + 1) + ". " + genearray.get(i).getName(), buf) .getWidth(); if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString((i + 1) + ". " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( (i + 1) + ". " + genearray.get(i).getName() + " ... " + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGenename(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) { buf.drawString((i + 1) + ". " + " ... " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString((i + 1) + ". " + genearray.get(i).getName() + " ... ", 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString((i + 1) + ". " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[1][0] + 1), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) (headerlengths[1][1]), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } mutcountbuffer = new StringBuffer("" + genearray.get(i).mutations + " ("); buf.drawString(mutcountbuffer.toString(), (int) (headerlengths[1][0] + 5), (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (genearray.get(i).nonsense > 0) { buf.setColor(Color.red); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).nonsense, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).nonsense); dot = true; } if (genearray.get(i).missense > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.setColor(Color.yellow); buf.drawString("" + genearray.get(i).missense, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).missense); dot = true; } if (genearray.get(i).synonymous > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.setColor(Color.green); buf.drawString("" + genearray.get(i).synonymous, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).synonymous); dot = true; } if (genearray.get(i).utr > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } buf.setColor(Color.lightGray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).utr, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).utr); dot = true; } if (genearray.get(i).intronic > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).intronic, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).intronic); dot = true; } if (genearray.get(i).intergenic) { buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).mutations, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append("" + genearray.get(i).mutations); } buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(") ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString() + ") ", buf).getWidth(); if (genearray.get(i).samples.size() == 1) { buf.drawString(" 1 sample", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(" " + genearray.get(i).samples.size() + " samples", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[2][0]) + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString(genearray.get(i).getChrom(), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-" + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0) .getTranscripts().get(1).getStart()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) { buf.drawString( genearray.get(i).getChrom() + ":1-" + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0) .getTranscripts().get(1).getStart()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-end", (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getStart()) + "-" + MethodLibrary.formatNumber(genearray.get(i).getEnd()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[3][0]) + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString("-", (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( genearray.get(i).getDescription() + ";" + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGene() .getDescription(), (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString(genearray.get(i).getDescription(), (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.darkGray); buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int r = 0; r < headerlengths.length; r++) { buf.drawLine((int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedNode != null && selectedNode.equals(genearray.get(i))) { hoverSample = -1; genemutcount = aminoarray.size() + 1; listAdd = 1; // buf.drawLine(10, (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3, this.getWidth(), (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3); drawGeneheader( (rowHeight * (i + listAdd + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int s = 0; s < aminoarray.size(); s++) { buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("nonsense")) { textcolor = Color.red; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("missense")) { textcolor = Color.yellow; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("synonymous")) { textcolor = Color.green; } else if (aminoarray.get(s).getRow()[3].contains("UTR")) { textcolor = Color.lightGray; } else { textcolor = Color.gray; } buf.setColor(textcolor); if (mouseY >= (rowHeight * (i + s + listAdd + 2)) && mouseY < (rowHeight * (i + s + listAdd + 3))) { hoverNode = null; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); buf.setColor(Color.white); hoverSample = -1; if (aminoarray.get(s).getRow()[1].equals("1")) { for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getSample().getIndex(); hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue().get(0); hoverBase = aminoarray.get(s).getRow()[5]; break; } } } // hoverSample = -1; } if (!aminoarray.get(s).getRow()[1].equals("1")) { buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(0).getSample() .getName(), 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); break; } } } if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) { //TODO textcolor = Color.white; } for (int h = 1; h < 4; h++) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(h)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(h)[2], rowHeight - 1); buf.setColor(textcolor); if (h == 3) { if (aminoarray.get(s).getRow()[5].length() == 1) { buf.drawString( Main.getBase.get(aminoarray.get(s).getNode().getRefBase()) + ">" + aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(4)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(4)[2], rowHeight - 1); buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } if (aminoarray.get(s).getRow()[1].equals("1")) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(5)[2], rowHeight - 1); buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0).isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 2; casefreq = 2 / (double) (Main.varsamples * 2 - 2); } } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 1; casefreq = 1 / (double) (Main.varsamples * 2 - 1); } } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(6)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getQuality(), (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } else { //TODO piirra mustat boksit buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (Control.controlData.controlsOn) { cases = 0; for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { for (int j = 0; j < aminoarray.get(s).getNode().vars.get(v).getValue() .size(); j++) { if (aminoarray.get(s).getNode().vars.get(v).getValue() .get(j).alleles != null) { continue; } if (aminoarray.get(s).getNode().vars.get(v).getValue().get(j) .isHomozygous()) { cases += 2; } else { cases += 1; } } } } casefreq = cases / (double) (Main.varsamples * 2 - cases); } } buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(7)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); // buf.setColor(Color.black); if (Control.controlData.controlsOn) { buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { vararray = aminoarray.get(s).getNode().vars.get(v).getValue(); controlarray = new SampleNode[Control.controlData.fileArray.size()]; if (vararray.get(vararray.size() - 1).alleles != null) { for (int e = vararray.size() - 1; e > 0; e--) { if (vararray.get(e).alleles == null) { break; } controlarray[vararray.get(e).getControlSample().getIndex()] = vararray .get(e); } } for (int e = 0; e < controlarray.length; e++) { if (Control.controlData.fileArray.get(e).controlOn) { if (controlarray[e] == null) { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("0", (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("-", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + MethodLibrary.round(controlarray[e].alleles / (double) controlarray[e].allelenumber, 5), (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + MethodLibrary.round(casefreq / (controlarray[e].alleles / (double) (controlarray[e].allelenumber - controlarray[e].alleles)), 2) + " (p=" + MethodLibrary.round( fe.getRightTailedP(cases, Main.varsamples * 2 - cases, controlarray[e].alleles, controlarray[e].allelenumber - controlarray[e].alleles), 2) + ")", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("Apply controls", (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("-", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } } else { buf.setColor(Color.darkGray); for (int e = geneheaderlength; e < geneheader.size(); e++) { if (geneheader.get(e)[0] instanceof ControlFile) { buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } buf.setColor(Color.lightGray); } vararray = null; //if(Main.bedCanvas.bedOn) { for (int a = 0; a < aminoarray.size(); a++) { bedarray = MethodLibrary.makeTrackArray(aminoarray.get(a).getNode(), aminoarray.get(a).getRow()[5]); if (bedarray != null) { for (int b = 0; b < bedarray.length; b++) { buf.setColor(Color.black); if (b == bedarray.length - 1) { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth() - (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1], rowHeight - 1); } else { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[2], rowHeight - 1); } buf.setColor(Color.white); if (bedarray[b] != null) { buf.drawString(bedarray[b].toString(), (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 14, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } /*if(c < header.size()-1-Main.bedCanvas.bedTrack.size()) { buf.setColor(Color.black); buf.fillRect((int)header.get(c+1)[1]+1, (rowHeight*(i+genemutcount+1))-tablescroll.getVerticalScrollBar().getValue()+4, (int)header.get(c)[2], rowHeight-1); }*/ // } buf.setColor(Color.darkGray); for (int j = 0; j < geneheader.size(); j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow()) && Integer.parseInt(selectedString[1]) > 1) { pointer = 0; //TODO for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey().equals(selectedString[5])) { for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue() .size(); l++) { if (aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).alleles != null) { break; } if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().annotation) { continue; } if (mouseY > (rowHeight * (i + s + pointer + 4)) && mouseY < (rowHeight * (i + s + pointer + 5))) { textcolor = Color.white; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().getIndex(); hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue() .get(l); hoverBase = aminoarray.get(s).getRow()[5]; } else { textcolor = Color.lightGray; } // if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) { buf.setColor(textcolor); buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().getName(), 30, (rowHeight * (i + s + pointer + 4)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); pointer++; // } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(6)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars .get(v).getValue().get(l).getQuality(), (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.darkGray); for (int j = 5; j < 7; j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue(), (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight + 2); } } } } listAdd = Integer.parseInt(selectedString[1]) + 1; genemutcount = aminoarray.size() + listAdd; buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } } } } catch (Exception e) { ErrorLog.addError(e.getStackTrace()); e.printStackTrace(); } } buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); drawHeader(); if (headerHover == -1 && geneHeaderHover == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (resizeColumn == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); } } g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null); }
From source file:net.fenyo.gnetwatch.GUI.BasicComponent.java
/** * Displays the number of frames per second. * @param fps frames per second to display. * @return void.//from w ww.j av a2s .c o m */ // AWT thread private void paintFPS(final int fps) { backing_g.setColor(Color.GRAY); if (!manual_mode) { // traduire backing_g.drawString(fps + " frames/s - press any key or mouse button to enter manual scaling mode", 1, 13); backing_g.setColor(Color.YELLOW); backing_g.drawString("AUTO", 60, 50); } else { // traduire backing_g.drawString( "keys: '<' horiz. scale down '>' horiz. scale up '-' vert. scale down '+' vert. scale up 'n' current date 'a' automatic scaling mode", 1, 13); backing_g.setColor(Color.YELLOW); backing_g.drawString("MANUAL", 60, 50); } }
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void jSearchTextFieldKeyReleased(KeyEvent evt) { String text = jTextArea.getText().toLowerCase(); String searchPattern = jSearchTextField.getText().toLowerCase(); if (evt != null && evt.getKeyCode() == 10) { int caretPosition = jTextArea.getCaretPosition(); boolean found = false; for (int j = caretPosition + 1; j < text.length() - searchPattern.length(); j += 1) { if (searchPattern.equals(text.substring(j, j + searchPattern.length()))) { jTextArea.setCaretPosition(j); found = true;// www.j a va 2s . c o m break; } } if (!found) { for (int j = 0; j < caretPosition; j++) { if (searchPattern.equals(text.substring(j, j + searchPattern.length()))) { jTextArea.setCaretPosition(j); break; } } } } if (searchPattern.length() > 0) { Highlighter h = jTextArea.getHighlighter(); DefaultHighlightPainter painter = new DefaultHighlightPainter(Color.YELLOW); DefaultHighlightPainter painter2 = new DefaultHighlightPainter(Color.RED); h.removeAllHighlights(); int count = 0; boolean isCurrent = false; for (int j = 0; j < text.length(); j += 1) { if (j < text.length() - searchPattern.length() && searchPattern.equals(text.substring(j, j + searchPattern.length()))) { count++; try { if (j >= jTextArea.getCaretPosition() && isCurrent == false) { h.addHighlight(j, j + searchPattern.length(), painter2); isCurrent = true; } else { h.addHighlight(j, j + searchPattern.length(), painter); } } catch (BadLocationException ble) { } } } jSearchLabel.setText("Match:" + count); } else { jSearchLabel.setText(""); Highlighter h = jTextArea.getHighlighter(); h.removeAllHighlights(); } }
From source file:com.ctsim.dmi.MainFrame.java
private void drawButton(String name, int status, int x, int y, boolean isRequest) { FontMetrics metrics = g2.getFontMetrics(); int strWidth = metrics.stringWidth(name); g2.setStroke(new BasicStroke(2)); if (App.atpStatus == status) { g2.setColor(Color.GREEN); g2.fillRect(x, y, bttnWidth, bttnHeight); g2.setColor(Color.BLACK); } else if (isRequest) { if (isFlashOn) { g2.setStroke(new BasicStroke(4)); g2.setColor(Color.YELLOW); } else {/* w w w . ja v a2s. c o m*/ g2.setStroke(new BasicStroke(2)); g2.setColor(Color.LIGHT_GRAY); } } else { g2.setStroke(new BasicStroke(2)); g2.setColor(Color.LIGHT_GRAY); } g2.drawRect(x, y, bttnWidth, bttnHeight); g2.drawString(name, x + (bttnWidth / 2) - strWidth / 2, y + bttnHeight - 5 - metrics.getHeight() / 2); }
From source file:com.att.aro.ui.view.diagnostictab.GraphPanel.java
/** * Initializes a new instance of the GraphPanel class. */// w w w.j a va 2 s .c om public GraphPanel(IAROView aroview, DiagnosticsTab parent) { if (statemachinefactory == null) { statemachinefactory = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class); } if (burstcollectionanalyzer == null) { burstcollectionanalyzer = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class); } if (packetanalyzer == null) { packetanalyzer = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class); } if (graphHelper == null) { graphHelper = new GraphPanelHelper(); } if (guiPreferences == null) { guiPreferences = GUIPreferences.getInstance(); } if (barPlot == null) { barPlot = new CreateBarPlot(); } this.parent = parent; subplotMap.put(ChartPlotOptions.THROUGHPUT, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.throughput"), getBarPlot().drawXYItemPlot(), 2)); subplotMap.put(ChartPlotOptions.BURSTS, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bursts"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.USER_INPUT, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.userInput"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.RRC, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.rrc"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.ALARM, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.alarm"), getBarPlot().drawXYBarPlot(Color.gray, true), 2)); subplotMap.put(ChartPlotOptions.GPS, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.gps"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.BUFFER_OCCUPANCY, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.buffer.occupancy"), getBarPlot().drawXYItemPlot(), 1)); subplotMap.put(ChartPlotOptions.VIDEO_CHUNKS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.video.chunks"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.RADIO, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.radio"), getBarPlot().drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.red, MIN_SIGNAL, MAX_SIGNAL), 2)); subplotMap.put(ChartPlotOptions.BLUETOOTH, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bluetooth"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.CAMERA, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.camera"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.SCREEN, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.screen"), getBarPlot().drawXYBarPlot(new Color(34, 177, 76), false), 1)); subplotMap.put(ChartPlotOptions.BATTERY, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.battery"), getBarPlot().drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.red, MIN_BATTERY, MAX_BATTERY), 2)); subplotMap.put(ChartPlotOptions.TEMPERATURE, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.temperature"), getBarPlot() .drawStandardXYPlot(DEFAULT_POINT_SHAPE, Color.green, MIN_TEMPERATURE, MAX_TEMPERATURE), 2)); subplotMap.put(ChartPlotOptions.WAKELOCK, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.wakelock"), getBarPlot().drawXYBarPlot(Color.yellow, false), 1)); subplotMap.put(ChartPlotOptions.WIFI, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.wifi"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.NETWORK_TYPE, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.networkType"), getBarPlot().drawXYBarPlot(Color.gray, false), 1)); subplotMap.put(ChartPlotOptions.CPU, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.cpu"), getBarPlot().drawStandardXYPlot(CPU_PLOT_POINT_SHAPE, Color.black, MIN_CPU_USAGE, MAX_CPU_USAGE), 1)); subplotMap.put(ChartPlotOptions.UL_PACKETS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.ul"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.DL_PACKETS, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.dl"), getBarPlot().drawYIntervalPlot(), 1)); subplotMap.put(ChartPlotOptions.BUFFER_TIME_OCCUPANCY, new GraphPanelPlotLabels(ResourceBundleHelper.getMessageString("chart.bufferTime.occupancy"), getBarPlot().drawXYItemPlot(), 1)); subplotMap.put(ChartPlotOptions.ATTENUATION, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.attenuation"), getBarPlot().drawStepChartPlot(), 2)); subplotMap.put(ChartPlotOptions.SPEED_THROTTLE, new GraphPanelPlotLabels( ResourceBundleHelper.getMessageString("chart.attenuation"), getBarPlot().drawStepChartPlot(), 2)); setLayout(new BorderLayout()); setMinimumSize(new Dimension(300, 280)); add(getZoomSavePanel(), BorderLayout.EAST); add(getPane(), BorderLayout.CENTER); setGraphPanelBorder(true); setChartOptions(guiPreferences.getChartPlotOptions()); }
From source file:org.tsho.dmc2.core.chart.DmcLyapunovPlot.java
public LegendItemCollection getLegendItems() { if (type != AREA) return null; Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL); Shape shape = new Rectangle2D.Double(-3, -3, 6, 6); LegendItemCollection legendItems = new LegendItemCollection(); legendItems.add(new LegendItem("both zero", "", shape, true, Color.black, stroke, Color.yellow, stroke)); legendItems.add(new LegendItem("zero, positive", "", shape, true, Color.red, stroke, Color.yellow, stroke)); legendItems//from w w w.ja v a 2 s .co m .add(new LegendItem("zero, negative", "", shape, true, Color.blue, stroke, Color.yellow, stroke)); legendItems.add( new LegendItem("positive, negative", "", shape, true, Color.green, stroke, Color.yellow, stroke)); legendItems .add(new LegendItem("both positive", "", shape, true, Color.orange, stroke, Color.yellow, stroke)); legendItems.add(new LegendItem("both negative", "", shape, true, Color.pink, stroke, Color.yellow, stroke)); return legendItems; }