Example usage for java.awt Color cyan

List of usage examples for java.awt Color cyan

Introduction

In this page you can find the example usage for java.awt Color cyan.

Prototype

Color cyan

To view the source code for java.awt Color cyan.

Click Source Link

Document

The color cyan.

Usage

From source file:mil.tatrc.physiology.utilities.csv.plots.MultiPlotter.java

protected void formatMultiPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1,
        XYSeriesCollection dataSet2) {//w w  w. j  a v  a 2s  .c  o  m
    Color[] blueColors = { Color.blue, Color.cyan, new Color(0, 160, 255), new Color(0, 100, 255),
            new Color(0, 160, 255), new Color(14, 0, 145), new Color(70, 105, 150) };
    Color[] redColors = { Color.red, Color.magenta, new Color(255, 0, 100), new Color(255, 0, 160), Color.pink,
            new Color(145, 0, 0), new Color(132, 58, 58) };
    Color[] variedColors = { Color.red, Color.blue, Color.green, Color.orange, Color.magenta, Color.cyan,
            Color.gray, new Color(255, 165, 0), new Color(42, 183, 136), new Color(87, 158, 186) };
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(2.0f);

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);

    //If there is only one Y axis, we just need to color the data series differently
    if (job.Y2headers == null || job.Y2headers.isEmpty()) {
        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 9)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, variedColors[cIndex]);
            renderer1.setSeriesPaint(i, variedColors[cIndex]);
        }
    }
    //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing
    else {
        StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
        plot.setRenderer(1, renderer2);

        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, redColors[cIndex]);
            renderer1.setSeriesPaint(i, redColors[cIndex]);
        }
        for (int i = 0, cIndex = 0; i < dataSet2.getSeriesCount(); i++, cIndex++) {
            renderer2.setSeriesStroke(i, wideLine);
            renderer2.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer2.setSeriesFillPaint(i, blueColors[cIndex]);
            renderer2.setSeriesPaint(i, blueColors[cIndex]);
        }
        plot.getRangeAxis(0).setLabelPaint(redColors[0]);
        plot.getRangeAxis(0).setTickLabelPaint(redColors[0]);
        plot.getRangeAxis(1).setLabelPaint(blueColors[0]);
        plot.getRangeAxis(1).setTickLabelPaint(blueColors[0]);
    }
}

From source file:com.bdb.weather.display.freeplot.HistoricalFreePlot.java

/**
 * Create the series for wind values./*from w  ww  .j  a  va 2  s  . co m*/
 * 
 * @param stroke The stroke that is used to draw the series
 * @param timeMethod The method that is used to "get" the date from the record
 */
private List<FreePlotSeries<HistoricalRecord>> createWindSeries(Stroke stroke,
        Function<HistoricalRecord, TemporalAccessor> timeMethod) {
    List<FreePlotSeries<HistoricalRecord>> list = new ArrayList<>();
    int n = 0;
    list.add(new FreePlotSeries<>(SUSTAINED_WIND_SERIES_NAME, n++, Color.CYAN, stroke,
            HistoricalRecord::getAvgWindSpeed, timeMethod, INTERVAL_CLASS));
    list.add(new FreePlotSeries<>(SUSTAINED_WIND_SERIES_NAME, n++, Color.ORANGE, stroke,
            HistoricalRecord::getHighWindSpeed, timeMethod, INTERVAL_CLASS));
    list.add(new FreePlotSeries<>(WIND_GUST_SERIES_NAME, n++, Color.yellow, stroke,
            HistoricalRecord::getWindGustSpeed, timeMethod, INTERVAL_CLASS));

    return list;
}

From source file:com.tiempometa.muestradatos.JProgramTags.java

@Override
public void handleReadings(List<TagReading> readings) {
    bibLabel.setText("");
    if (readings.size() > 0) {
        if (readings.size() == 1) {
            statusLabel.setBackground(Color.cyan);
            statusLabel.setText("Leyendo tag");
            for (TagReading tagReading : readings) {
                logger.info("Tag data dump");
                logger.info(tagReading.getTagReadData().getTag().epcString());
                logger.info(String.valueOf(tagReading.getTagReadData().getData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getEPCMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getEPCMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getTIDMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getTIDMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getReservedMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getReservedMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getUserMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getUserMemData()));
                if (tagReading.getTid() == null) {
                    try {
                        tagReading.setTid(ReaderContext.readTid(tagReading.getEpc(), 12));
                        if (logger.isDebugEnabled()) {
                            logger.debug("Got tag " + tagReading.getEpc() + " - " + tagReading.getTid());
                        }//from w  ww.j a va2s .c  om
                        // try {
                        statusLabel.setBackground(Color.green);
                        statusLabel.setText("Tag leido");
                        tidTextField.setText(tagReading.getTid().toLowerCase());
                        epcTextField.setText(tagReading.getEpc().toLowerCase());
                        programmedEpcTextField.setText("");
                        // find tag by EPC/TID in database
                        logger.debug("Looking up rfid by epc " + tagReading.getEpc() + " epc char "
                                + Hex.encodeHexString(tagReading.getEpc().getBytes()));
                        Rfid rfid = totalRfidMap.get(tagReading.getEpc().toUpperCase());
                        if (rfid == null) {
                            logger.debug("Rfid string not in database tag list. Programming tag.");
                            // if in DB, warn

                            // if not then program with next chipnumber
                            programTag(tagReading);

                        } else {
                            logger.debug("Rfid string IN database tag list.");
                            Rfid batchRfid = rfidMap.get(tagReading.getEpc());
                            if (batchRfid == null) {
                                logger.debug("Rfid string IN current program batch");
                                int response = JOptionPane.showConfirmDialog(this,
                                        "Este tag tiene un cdigo que existe en el evento actual.\n"
                                                + "Corresponde al nmero " + rfid.getBib()
                                                + "\nDesea sobreescribir este tag?",
                                        "Tag ya programado", JOptionPane.YES_NO_OPTION,
                                        JOptionPane.WARNING_MESSAGE);
                                if (response == JOptionPane.YES_OPTION) {
                                    programTag(tagReading);
                                }
                            } else {
                                JOptionPane.showMessageDialog(this,
                                        "Este tag tiene un cdigo que ya ha sido programado en este lote.",
                                        "Tag ya programado", JOptionPane.ERROR_MESSAGE);
                            }
                        }

                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        statusLabel.setBackground(Color.white);
                        statusLabel.setText("Remover tag");
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e1) {
                            e1.printStackTrace();
                        }
                    } catch (ReaderException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        statusLabel.setBackground(Color.red);
                        statusLabel.setText("Error");
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e1) {
                            e1.printStackTrace();
                        }
                    }
                }
            }
        } else {
            statusLabel.setBackground(Color.orange);
            statusLabel.setText("Dos o ms tags");
        }
    } else {
        statusLabel.setBackground(Color.yellow);
        statusLabel.setText("Sin tag");

    }

}

From source file:jboost.visualization.HistogramFrame.java

private JFreeChart createHistogramChart() {

    XYBarRenderer renderer1 = new XYBarRenderer();
    renderer1.setSeriesPaint(0, Color.cyan);
    renderer1.setSeriesPaint(1, Color.pink);

    XYPlot histPlot = new XYPlot(histogramDataset, null, new NumberAxis("count"), renderer1);

    XYBarRenderer renderer2 = new XYBarRenderer();
    renderer2.setSeriesPaint(0, Color.green);
    renderer2.setSeriesPaint(1, Color.orange);
    renderer2.setUseYInterval(true);//w w w  .ja va  2  s.c o  m

    // weight and potential
    if (infoParser.isRobustBoost || infoParser.isAdaBoost || infoParser.isLogLossBoost) {
        StandardXYItemRenderer renderer3 = new StandardXYItemRenderer();
        renderer3.setSeriesPaint(0, Color.blue);
        renderer3.setSeriesPaint(1, Color.red);
        renderer3.setBaseStroke(new BasicStroke(2));

        StandardXYItemRenderer renderer4 = new StandardXYItemRenderer();
        renderer4.setSeriesPaint(0, Color.blue);
        renderer4.setSeriesPaint(1, Color.red);
        renderer4.setBaseStroke(
                new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 2, new float[] { 2 }, 0));

        histPlot.setDataset(1, weightDataset);
        histPlot.setRenderer(1, renderer3);

        histPlot.setDataset(2, potentialDataset);
        histPlot.setRenderer(2, renderer4);

        histPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    }

    XYPlot fluctPlot = new XYPlot(fluctDataset, null, new NumberAxis("bin"), renderer2);

    double initialLocation = (upper_limit + lower_limit) / 2.0;
    histMarker = new IntervalMarker(initialLocation, initialLocation);
    histPlot.addDomainMarker(histMarker, Layer.BACKGROUND);
    fluctPlot.addDomainMarker(histMarker, Layer.BACKGROUND);

    // plot.setBackgroundPaint(Color.lightGray);
    // plot.setDomainGridlinePaint(Color.white);
    // plot.setRangeGridlinePaint(Color.white);

    CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(new NumberAxis("score"));
    combinedPlot.setGap(10.0);

    // add the subplots...
    ValueAxis axis = new NumberAxis();
    axis.setRange(rawData.getMinRange(iter), rawData.getMaxRange(iter));
    combinedPlot.add(histPlot, 3);
    combinedPlot.add(fluctPlot, 1);
    combinedPlot.setOrientation(PlotOrientation.VERTICAL);
    combinedPlot.setDomainAxis(axis);

    JFreeChart chart = new JFreeChart("Histogram", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot, false // legend
    );

    return chart;
}

From source file:hr.restart.util.chart.ChartXY.java

/**
 * Creates a BAR CHART/* ww  w.  j  a v  a2 s.  c o  m*/
 * @param dataset The org.jfree.data.CategoryDataset
 * @param title The title
 * @return org.jfree.chart.JFreeChart
 */
private JFreeChart createBarChart(final CategoryDataset dataset, String title, PlotOrientation orientation) {

    final JFreeChart chart = ChartFactory.createBarChart(title, // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            orientation, // the plot orientation
            false, // include legend
            true, false);

    chart.setBackgroundPaint(Color.white);

    // the subtitle from the combobox        
    if (jcb != null)
        chart.addSubtitle(new TextTitle(jcb.getSelectedItem().toString()));

    //subtitles setted by the user.
    if (getSubtitles() != null)
        for (int i = 0; i < getSubtitles().size(); i++) {
            chart.addSubtitle(new TextTitle(getSubtitles().get(i).toString()));
        }

    final Plot plot = chart.getPlot();

    // get a reference to the plot for further customisation...
    final CategoryPlot categoryPlot = (CategoryPlot) plot;

    categoryPlot.setNoDataMessage("NO DATA!");

    categoryPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });
    categoryPlot.setRenderer(renderer);

    renderer.setLabelGenerator(new StandardCategoryLabelGenerator());
    renderer.setItemLabelsVisible(true);

    // inside
    //renderer.setBaseItemLabelPaint(Color.white);
    Font font = new Font("SansSerif", Font.PLAIN, 7);
    Font derive = font.deriveFont(Font.BOLD);
    renderer.setBaseItemLabelFont(derive);

    // margin
    final CategoryAxis domainAxis = categoryPlot.getDomainAxis();
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    //domainAxis.setBottomCategoryLabelPosition(new CategoryLabelPosition(RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_CENTER));
    domainAxis.setCategoryLabelPositions(new CategoryLabelPositions(
            new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.TOP_CENTER), // TOP
            new CategoryLabelPosition(RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_CENTER), // BOTTOM
            new CategoryLabelPosition(RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT,
                    CategoryLabelWidthType.RANGE, 0.30f), // LEFT
            new CategoryLabelPosition(RectangleAnchor.RIGHT, TextBlockAnchor.CENTER_RIGHT,
                    CategoryLabelWidthType.RANGE, 0.30f) // RIGHT) 
    ));

    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 0.0);
    renderer.setPositiveItemLabelPosition(p);

    if (comboBoxOrientation != null) {
        if (comboBoxOrientation.getSelectedItem() == "Vertikalni") {

            domainAxis.setCategoryLabelPositions(
                    CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4.0));
        }
    }

    return chart;

}

From source file:network.view.relacoesEntidadesUI.GraphViewEntity.java

private VisualizationViewer paintGraph(Graph graph, Grafo g) {

    //layout = new FRLayout(graph);
    layout = new StaticLayout(graph);
    pr = new PluggableRenderer();
    vv = new VisualizationViewer(layout, pr);
    vv.addGraphMouseListener(new MyGraphMouseListenerEntity());

    vv.setBackground(Color.white);

    /*/*from   w  w  w  . j  ava2  s  .c  o m*/
     * EdgeStringer usado na classe EntityViewEntity para
     * a visualizao das relaes.
     * Este EdgeStringer nao deve ser visualizado no grafo,
     * apenas na tela de relacoes (EntityViewEntity)
     * No usar pr.setEdgeStringer(myStringer);
     */
    myStringer = new MyEdgeStringerEntity(edgesValues, g);

    myStringerOnlyGraph = new MyEdgeStringerEntityOnlyGraph(edgesValues, g);
    pr.setEdgeStringer(myStringerOnlyGraph);

    MyPickableEdgePaintFunction myPickableEdgePaintFunction = new MyPickableEdgePaintFunction(pr, Color.black,
            Color.cyan);
    pr.setEdgePaintFunction(myPickableEdgePaintFunction);

    myStringerV = new MyVertexStringerEntity(v, g);
    pr.setVertexStringer(myStringerV);

    MyEdgeStrokeFunction myStroke = new MyEdgeStrokeFunction();
    pr.setEdgeStrokeFunction(myStroke);

    pr.setVertexPaintFunction(new MyVertexPaintFunction());

    myVertexDisplayPredicate = new VertexDisplayPredicate(true);
    pr.setVertexIncludePredicate(myVertexDisplayPredicate);

    myEdgeDisplayPredicate = new EdgeDisplayPredicate(false);
    pr.setEdgeIncludePredicate(myEdgeDisplayPredicate);

    myToolTipFunction = new MyToolTipFunction(v, g);
    vv.setToolTipFunction(myToolTipFunction);

    return vv;
}

From source file:com.bdb.weather.display.freeplot.HistoricalFreePlot.java

/**
 * Create the series for rain values./*from   w ww .  j  a va2s .  c  o m*/
 * 
 * @param stroke The stroke that is used to draw the series
 * @param timeMethod The method that is used to "get" the date from the record
 */
private List<FreePlotSeries<HistoricalRecord>> createRainSeries(Stroke stroke,
        Function<HistoricalRecord, TemporalAccessor> timeMethod) {
    List<FreePlotSeries<HistoricalRecord>> list = new ArrayList<>();
    int n = 0;
    list.add(new FreePlotSeries<>(RAIN_SERIES_NAME, n++, Color.BLUE, stroke, HistoricalRecord::getRainfall,
            timeMethod, INTERVAL_CLASS));
    list.add(new FreePlotSeries<>(HIGH_RAIN_RATE_SERIES_NAME, n++, Color.CYAN, stroke,
            HistoricalRecord::getHighRainfallRate, timeMethod, INTERVAL_CLASS));

    return list;
}

From source file:edu.unibonn.kmeans.mapreduce.plotting.TimeSeriesPlotter_KMeans.java

private Paint getColor(int color_number) {
    Color curr_color = null;/*www .  j a  v  a 2 s .  com*/

    switch (color_number) {
    case 0:
        curr_color = Color.BLUE;
        break;
    case 1:
        curr_color = Color.GREEN;
        break;
    case 2:
        curr_color = Color.RED;
        break;
    case 3:
        curr_color = Color.PINK;
        break;
    case 4:
        curr_color = Color.MAGENTA;
        break;
    case 5:
        curr_color = Color.CYAN;
        break;
    case 6:
        curr_color = Color.DARK_GRAY;
        break;
    case 7:
        curr_color = Color.LIGHT_GRAY;
        break;
    case 8:
        curr_color = Color.YELLOW;
        break;
    case 9:
        curr_color = Color.ORANGE;
        break;
    case 10:
        curr_color = Color.BLACK;
        break;
    //           case 11: curr_color = Color.YELLOW;
    //                    break;
    //           case 12: curr_color = Color.BLACK;
    //                    break;
    //           case 13: curr_color = Color.BLACK;
    //                  break;
    //           case 14: curr_color = Color.BLACK;
    //                  break;
    //           case 15: curr_color = Color.BLACK;
    //                break;
    //           case 16: curr_color = Color.BLACK;
    //                break;
    //           case 17: curr_color = Color.BLACK;
    //                break;
    //           case 18: curr_color = Color.BLACK;
    //                break;
    //           case 20: curr_color = Color.BLACK;
    //                break;
    //           case 21: curr_color = Color.BLACK;
    //                break;
    //           case 22: curr_color = Color.BLACK;
    //                break;
    //           case 23: curr_color = Color.BLACK;
    //                break;
    default:
        curr_color = Color.WHITE;
        break;
    }

    return curr_color;
}

From source file:com.tiempometa.muestradatos.JReadTags.java

@Override
public void handleReadings(List<TagReading> readings) {
    bibLabel.setText("");
    if (readings.size() > 0) {
        if (readings.size() == 1) {
            statusLabel.setBackground(Color.cyan);
            statusLabel.setText("Leyendo tag");
            for (TagReading tagReading : readings) {
                logger.info("Tag data dump");
                logger.info(tagReading.getTagReadData().getTag().epcString());
                logger.info(String.valueOf(tagReading.getTagReadData().getData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getEPCMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getEPCMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getTIDMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getTIDMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getReservedMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getReservedMemData()));
                logger.info(String.valueOf(tagReading.getTagReadData().getUserMemData().length));
                logger.info(Hex.encodeHexString(tagReading.getTagReadData().getUserMemData()));
                if (tagReading.getTid() == null) {
                    try {
                        tagReading.setTid(ReaderContext.readTid(tagReading.getEpc(), 12));
                        if (logger.isDebugEnabled()) {
                            logger.debug("Got tag " + tagReading.getEpc() + " - " + tagReading.getTid());
                        }/*from ww w.  j  av  a 2 s .  c o m*/
                        try {
                            statusLabel.setBackground(Color.green);
                            statusLabel.setText("Tag leido");
                            tidTextField.setText(tagReading.getTid());
                            epcTextField.setText(tagReading.getEpc());
                            String rfidString = null;
                            switch (dataToStoreComboBox.getSelectedIndex()) {
                            case 0:
                                rfidString = tagReading.getEpc();
                                break;
                            case 1:
                                rfidString = tagReading.getTid();
                                break;
                            default:
                                break;
                            }
                            List<Rfid> rfids = rfidDao.findByRfid(rfidString);
                            if (rfids.size() == 0) {
                                String bib = nextBibTextField.getText();
                                Rfid bibRfid = rfidDao.fetchByBib(bib);
                                if ((bibRfid != null) & (!allowDuplicateBibsCheckBox.isSelected())) {
                                    JOptionPane.showMessageDialog(this, "Ese nmero ya ha sido capturado",
                                            "Nmero duplicado", JOptionPane.ERROR_MESSAGE);
                                } else {
                                    Integer chipNumber = null;
                                    try {
                                        chipNumber = Integer.valueOf(bib);
                                        Rfid rfid = new Rfid(null, null, bib, rfidString, chipNumber,
                                                Rfid.STATUS_NOT_ASSIGNED);
                                        rfidDao.save(rfid);
                                        tagTableModel.getData().add(rfid);
                                        tagTableModel.fireTableDataChanged();
                                        statusLabel.setText("Tag guardado");
                                        chipNumber = chipNumber + 1;
                                        nextBibTextField.setText(String.valueOf(chipNumber));
                                    } catch (NumberFormatException e) {
                                        JOptionPane.showMessageDialog(this,
                                                "El valor de nmero debe ser numrico", "Error de datos",
                                                JOptionPane.ERROR_MESSAGE);
                                    }
                                }
                            } else {
                                statusLabel.setBackground(Color.red);
                                statusLabel.setText("Tag ya leido");
                                Rfid rfid = rfids.get(0);
                                bibLabel.setText(rfid.getBib());
                                try {
                                    Thread.sleep(1000);
                                } catch (InterruptedException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }

                            }
                        } catch (SQLException e1) {
                            JOptionPane.showMessageDialog(this, "Error guardando tag: " + e1.getMessage(),
                                    "Error de base de datos", JOptionPane.ERROR_MESSAGE);
                        }

                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        statusLabel.setBackground(Color.white);
                        statusLabel.setText("Remover tag");
                    } catch (ReaderException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        statusLabel.setBackground(Color.red);
                    }
                }
            }
        } else {
            statusLabel.setBackground(Color.orange);
            statusLabel.setText("Dos o ms tags");
        }
    } else {
        statusLabel.setBackground(Color.yellow);
        statusLabel.setText("Sin tag");

    }

}

From source file:cs.cirg.cida.CIDAView.java

@Action
public void plotGraph() {
    lineSeriesComboBox.removeAllItems();
    int numSelectedColumns = userSelectedColumns.size();
    int numSelectedRows = userSelectedRows.size();
    if (numSelectedColumns == 0) {
        return;//ww w  . ja va2 s. c  om
    }
    StandardDataTable<Numeric> data = (StandardDataTable<Numeric>) ((IOBridgeTableModel) analysisTable
            .getModel()).getDataTable();
    List<Numeric> iterations = data.getColumn(0);

    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();

    for (int i = 0; i < numSelectedColumns; i++) {
        int selectedColumnIndex = userSelectedColumns.get(i);
        List<Numeric> selectedColumn = data.getColumn(selectedColumnIndex);

        XYSeries series = new XYSeries(data.getColumnName(selectedColumnIndex));

        for (int k = 0; k < numSelectedRows; k++) {
            int selectedRowIndex = userSelectedRows.get(k);
            series.add(iterations.get(selectedRowIndex).getReal(),
                    selectedColumn.get(selectedRowIndex).getReal());
        }
        xySeriesCollection.addSeries(series);
        lineSeriesComboBox.addItem(new SeriesPair(i, (String) series.getKey()));
    }

    String chartName = experimentController.getAnalysisName();
    if (chartName.compareTo("") == 0) {
        chartName = CIDAConstants.DEFAULT_CHART_NAME;
    }
    JFreeChart chart = ChartFactory.createXYLineChart(chartName, // Title
            CIDAConstants.CHART_ITERATIONS_LABEL, // X-Axis label
            CIDAConstants.CHART_VALUE_LABEL, // Y-Axis label
            xySeriesCollection, // Dataset
            PlotOrientation.VERTICAL, true, // Show legend,
            false, //tooltips
            false //urls
    );
    chart.setAntiAlias(true);
    chart.setAntiAlias(true);
    XYPlot plot = (XYPlot) chart.getPlot();
    Paint[] paints = new Paint[7];
    paints[0] = Color.RED;
    paints[1] = Color.BLUE;
    paints[2] = new Color(0.08f, 0.5f, 0.04f);
    paints[3] = new Color(1.0f, 0.37f, 0.0f);
    paints[4] = new Color(0.38f, 0.07f, 0.42f);
    paints[5] = Color.CYAN;
    paints[6] = Color.PINK;
    plot.setDrawingSupplier(
            new DefaultDrawingSupplier(paints, paints, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                    DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.GRAY);
    plot.setRangeGridlinePaint(Color.GRAY);

    IntervalXYRenderer renderer = new IntervalXYRenderer(true, false);
    plot.setRenderer(renderer);
    lineTickIntervalInput.setText(Integer.toString(renderer.getLineTickInterval()));

    ((ChartPanel) chartPanel).setChart(chart);
}