Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

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

Prototype

Color YELLOW

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

Click Source Link

Document

The color yellow.

Usage

From source file:org.tsho.dmc2.core.chart.LyapunovRenderer.java

public LegendItemCollection getLegendItems() {
    if (type != TYPE_AREA)
        return null;
    LegendItemCollection legendItems = new LegendItemCollection();

    Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);
    Shape shape = new Rectangle2D.Double(-3, -3, 6, 6);

    Iterator i = signsSet.iterator();
    while (i.hasNext()) {
        ExpsSigns es = (ExpsSigns) i.next();
        Color color = lyapunovColors.getColor(es.zer, es.pos, es.neg, es.nan);
        legendItems.add(new LegendItem(es.toString(), "", shape, true, color, stroke, Color.yellow, stroke));
    }//from w w  w  .ja va  2s.c  o  m
    if (pass == 0) {
        signsSet.clear();
    }
    return legendItems;
}

From source file:whitebox.stats.Kriging.java

/**
 * Draw Semivariogram surface map and also draw the search are if
 * Anisotropic/*from  w ww .  j a  v  a2  s. co  m*/
 *
 * @param Radius
 * @param AnIsotropic
 */
public void DrawSemivariogramSurface(double Radius, boolean AnIsotropic) {
    double[][] data = new double[3][BinSurface.length * BinSurface[0].length];
    int n = 0;
    double max = Double.MIN_VALUE;
    for (int i = 0; i < BinSurface.length; i++) {
        for (int j = 0; j < BinSurface[i].length; j++) {
            data[0][n] = BinSurface[i][j].GridHorDistance;
            data[1][n] = BinSurface[i][j].GridVerDistance;
            if ((Math.pow(data[0][n], 2) + Math.pow(data[1][n], 2)) <= Radius * Radius
                    && !Double.isNaN(BinSurface[i][j].Value)) {
                data[2][n] = BinSurface[i][j].Value;
                if (max < data[2][n]) {
                    max = data[2][n];
                }
            } else {
                data[2][n] = -1;
            }
            n++;
        }
    }
    DefaultXYZDataset dataset = new DefaultXYZDataset();
    dataset.addSeries("Value", data);
    NumberAxis xAxis = new NumberAxis();

    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);
    NumberAxis yAxis = new NumberAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.0);
    yAxis.setUpperMargin(0.0);
    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(LagSize);
    renderer.setBlockHeight(LagSize);
    renderer.setBlockAnchor(RectangleAnchor.CENTER);

    LookupPaintScale paintScale = new LookupPaintScale(0, max, Color.white);
    double colorRange = max / 6;
    //double colorRange = 23013;
    paintScale.add(0.0, Color.blue);
    paintScale.add(1 * colorRange, Color.green);
    paintScale.add(2 * colorRange, Color.cyan);
    paintScale.add(3 * colorRange, Color.yellow);
    paintScale.add(4 * colorRange, Color.ORANGE);
    paintScale.add(5 * colorRange, Color.red);

    renderer.setPaintScale(paintScale);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinePaint(Color.white);

    if (AnIsotropic) {
        CombinedRangeXYPlot combinedrangexyplot = new CombinedRangeXYPlot();
        XYSeries seriesT1 = new XYSeries("1");
        XYSeriesCollection AngleCollct = new XYSeriesCollection();

        double bw = BandWidth;
        double r = bw / Math.sin(Tolerance);
        if (r > Radius) {
            bw = Radius * Math.sin(Tolerance);
            r = Radius;
        }
        seriesT1.add(r * Math.cos(Angle + Tolerance), r * Math.sin(Angle + Tolerance));

        if ((double) Math.round(Math.sin(Angle) * 10000) / 10000 != 0) {
            if ((double) Math.round(Math.cos(Angle) * 10000) / 10000 != 0) {
                double a = (1 + Math.pow(Math.tan(Angle), 2));
                double b = 2 * bw / Math.sin(Angle) * Math.pow(Math.tan(Angle), 2);
                double c = Math.pow(Math.tan(Angle), 2) * Math.pow(bw / Math.sin(Angle), 2)
                        - Math.pow(Radius, 2);
                double x1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y1 = Math.tan(Angle) * (x1 + bw / Math.sin(Angle));
                double x2 = (-b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y2 = Math.tan(Angle) * (x2 + bw / Math.sin(Angle));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));
                if (d1 < d2) {
                    seriesT1.add(x1, y1);
                } else {
                    seriesT1.add(x2, y2);
                }
            } else {
                double x1 = -bw * Math.sin(Angle);
                double y1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double y2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));

                if (d1 < d2) {
                    seriesT1.add(x1, y1);
                } else {
                    seriesT1.add(x1, y2);
                }
            }
        } else {
            double y1 = bw * Math.cos(Angle);
            double x1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double x2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
            double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));

            if (d1 < d2) {
                seriesT1.add(x1, y1);
            } else {
                seriesT1.add(x2, y1);
            }
        }

        AngleCollct.addSeries(seriesT1);

        XYSeries seriesT2 = new XYSeries("2");
        seriesT2.add(r * Math.cos(Angle + Tolerance), r * Math.sin(Angle + Tolerance));
        seriesT2.add(0.0, 0.0);
        AngleCollct.addSeries(seriesT2);

        XYSeries seriesT3 = new XYSeries("3");
        seriesT3.add(Radius * Math.cos(Angle), Radius * Math.sin(Angle));
        seriesT3.add(0, 0);
        AngleCollct.addSeries(seriesT3);

        XYSeries seriesT4 = new XYSeries("4");
        seriesT4.add(r * Math.cos(Angle - Tolerance), r * Math.sin(Angle - Tolerance));
        seriesT4.add(0, 0);
        AngleCollct.addSeries(seriesT4);

        XYSeries seriesT5 = new XYSeries("5");

        seriesT5.add(r * Math.cos(Angle - Tolerance), r * Math.sin(Angle - Tolerance));
        if ((double) Math.round(Math.sin(Angle) * 10000) / 10000 != 0) {
            if ((double) Math.round(Math.cos(Angle) * 10000) / 10000 != 0) {
                double a = (1 + Math.pow(Math.tan(Angle), 2));
                double b = -2 * bw / Math.sin(Angle) * Math.pow(Math.tan(Angle), 2);
                double c = Math.pow(Math.tan(Angle), 2) * Math.pow(bw / Math.sin(Angle), 2)
                        - Math.pow(Radius, 2);
                double x1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y1 = Math.tan(Angle) * (x1 - bw / Math.sin(Angle));
                double x2 = (-b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y2 = Math.tan(Angle) * (x2 - bw / Math.sin(Angle));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));
                if (d1 < d2) {
                    seriesT5.add(x1, y1);
                } else {
                    seriesT5.add(x2, y2);
                }
            } else {
                double x1 = bw * Math.sin(Angle);
                double y1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double y2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));

                if (d1 < d2) {
                    seriesT5.add(x1, y1);
                } else {
                    seriesT5.add(x1, y2);
                }
            }
        } else {
            double y1 = -bw * Math.cos(Angle);
            double x1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double x2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
            double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));

            if (d1 < d2) {
                seriesT5.add(x1, y1);
            } else {
                seriesT5.add(x2, y1);
            }
        }
        AngleCollct.addSeries(seriesT5);
        plot.setDataset(1, AngleCollct);
        XYLineAndShapeRenderer lineshapRend = new XYLineAndShapeRenderer(true, false);
        for (int i = 0; i < AngleCollct.getSeriesCount(); i++) {
            //plot.getRenderer().setSeriesPaint(i , Color.BLUE);
            lineshapRend.setSeriesPaint(i, Color.BLACK);
        }
        plot.setRenderer(1, lineshapRend);
        combinedrangexyplot.add(plot);
    }
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    JFreeChart chart = new JFreeChart("Semivariogram Surface", plot);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);

    // create and display a frame...
    ChartFrame frame = new ChartFrame("", chart);
    frame.pack();
    //frame.setSize(100, 50);
    frame.setVisible(true);
}

From source file:net.liuxuan.device.VACVBS.JIF_DrawChart_vacvbs.java

/**
 * ?jfreechart/* w  w w  .  j  a v  a 2s.co  m*/
 */
public void initChart() {
    ts_LP = new TimeSeries("LowPressure", Millisecond.class);
    ts_HP = new TimeSeries("HighPressure", Millisecond.class);
    ts_humidity = new TimeSeries("Humidity", Millisecond.class);
    ts_temprature = new TimeSeries("Temperature", Millisecond.class);
    ts_time = new TimeSeries("TestTime", Millisecond.class);
    ts_num = new TimeSeries("num", Millisecond.class);
    ts_reserved1 = new TimeSeries("reserved1", Millisecond.class);
    ts_reserved2 = new TimeSeries("reserved2", Millisecond.class);
    ts_reserved3 = new TimeSeries("reserved3", Millisecond.class);
    trcollection = new TimeSeriesCollection(ts_LP);

    trcollection.addSeries(ts_HP);

    trcollection2 = new TimeSeriesCollection(ts_humidity);

    trcollection2.addSeries(ts_temprature);

    //        trcollection2.addSeries(ts_num);
    //        trcollection2.addSeries(ts_time);
    //trcollection2.addSeries(ts_reserved1);
    //trcollection2.addSeries(ts_reserved2);
    //trcollection2.addSeries(ts_reserved3);

    //        timeseriescopylist.add(getTimeSeries(3).createCopy(0, getTimeSeries(3).getItemCount() - 1));
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("", "Time(s)", "PPM", trcollection,
            true, true, false);
    XYPlot xyplot = jfreechart.getXYPlot();

    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    Font fs = new Font("", Font.BOLD, 14);
    Font fs2 = new Font("", Font.BOLD, 12);

    XYLineAndShapeRenderer line0render = (XYLineAndShapeRenderer) xyplot.getRenderer(0);

    Color purple = new Color(139, 0, 255);

    line0render.setSeriesPaint(0, Color.blue);
    line0render.setSeriesPaint(1, Color.green);
    line0render.setSeriesPaint(2, Color.red);
    line0render.setSeriesPaint(3, purple);

    //        line0render.setSeriesPaint(3, Color.ORANGE);
    XYLineAndShapeRenderer line1render = new XYLineAndShapeRenderer();
    Color Rosered = new Color(230, 28, 100);
    line1render.setSeriesPaint(0, Color.cyan);
    line1render.setSeriesPaint(1, Rosered);
    line1render.setSeriesPaint(2, Color.orange);
    line1render.setSeriesPaint(3, Color.yellow);
    line1render.setBaseShapesVisible(false);
    xyplot.setRenderer(1, line1render);

    //??
    ValueAxis valueaxis = xyplot.getDomainAxis();

    //
    valueaxis.setLabelFont(fs);

    //
    valueaxis.setTickLabelFont(fs2);

    ValueAxis valueaxis2 = new NumberAxis("");
    valueaxis2.setLabelFont(fs);
    valueaxis2.setTickLabelFont(fs2);

    xyplot.setRangeAxis(1, valueaxis2);
    xyplot.setDataset(1, trcollection2);
    xyplot.mapDatasetToRangeAxis(1, 1);

    //??
    valueaxis.setAutoRange(true);
    //?? 7days
    //                valueaxis.setFixedAutoRange(604800000D);
    valueaxis = xyplot.getRangeAxis();

    valueaxis.setLabelFont(new Font("", Font.BOLD, 14));
    valueaxis.setLabelPaint(line0render.getSeriesPaint(0));
    valueaxis2.setLabelPaint(line1render.getSeriesPaint(0));

    jfreechart.getTitle().setFont(new Font("", Font.BOLD, 20));//
    jfreechart.getLegend().setItemFont(new Font("", Font.ITALIC, 15));
    xyplot.getRenderer(0).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}",
            new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000")));
    xyplot.getRenderer(1).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}",
            new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000")));
    chartPanel = new ChartPanel(jfreechart);

    initChartMenu();
    //        chartPanel.getPopupMenu().add(jmenuitem2);
    //        chartPanel.getPopupMenu().getPopupMenuListeners();

    chartPanel.setSize(950, 620);
    chartPanel.setPreferredSize(new Dimension(950, 620));
    jPanel_Show.add(chartPanel, BorderLayout.CENTER);
}

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

private void programTag(TagReading tagReading) throws ReaderException {
    Rfid rfid;// w w  w  .jav a 2  s . c  om
    Integer chipNumber = null;
    try {

        chipNumber = Integer.valueOf(nextChipnumberTextField.getText());
        List<Rfid> rfidList = rfidDao.findByChipNumber(chipNumber);
        if (rfidList.size() == 0) {
            JOptionPane.showMessageDialog(this, "No existe un chip con numero " + chipNumber, "Error de datos",
                    JOptionPane.ERROR_MESSAGE);
        } else {
            rfid = rfidList.get(0);
            String rfidString = rfid.getRfid();
            // program

            try {
                String accessPassword = null;
                String killPassword = null;
                ReaderContext.writeEpc(tagReading.getTagReadData(), rfidString);
                logger.info("Tag programmed");
                statusLabel.setBackground(Color.green);
                statusLabel.setText("Tag programado");
                tagTableModel.getData().add(rfid);
                tagTableModel.fireTableDataChanged();
                rfidMap.put(rfid.getRfid(), rfid);
                programmedEpcTextField.setText(rfidString.toLowerCase());
                chipNumber = chipNumber + 1;
                nextChipnumberTextField.setText(chipNumber.toString());
                if (lockCheckbox.isSelected()) {
                    logger.debug("Lock tag enabled");
                    if (accessPasswordTextField.getText().matches("[0-9a-fA-F]{8}?")) {
                        accessPassword = accessPasswordTextField.getText();
                    } else {
                        JOptionPane.showMessageDialog(this,
                                "Se debe especificar una contrasea de accesso de 8 caracteres (0-9, A-F)",
                                "Error de contrasea", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    if (killPasswordTextField.getText().matches("[0-9a-fA-F]{8}?")) {
                        killPassword = killPasswordTextField.getText();
                    } else {
                        JOptionPane.showMessageDialog(this,
                                "Se debe especificar una contrasea de desactivacin de 8 caracteres (0-9, A-F)",
                                "Error de contrasea", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    try {
                        short[] access = new short[2];
                        logger.debug("Building acces array:" + accessPassword.substring(0, 4) + ":"
                                + accessPassword.substring(4, 8));
                        access[0] = Integer.valueOf(accessPassword.substring(0, 4), 16).shortValue();
                        access[1] = Integer.valueOf(accessPassword.substring(4, 8), 16).shortValue();
                        logger.debug("Built access array");
                        short[] killword = new short[2];
                        killword[0] = Integer.valueOf(killPassword.substring(0, 4), 16).shortValue();
                        killword[1] = Integer.valueOf(killPassword.substring(4, 8), 16).shortValue();
                        logger.debug("Built killword array");
                        try {
                            TagData data = new TagData(rfidString);
                            logger.debug("Writing access...");
                            ReaderContext.writeAccess(access, data);
                            logger.debug("Writing kill...");
                            ReaderContext.writeKill(killword, data);
                            Integer password = Long.valueOf(accessPassword, 16).intValue();
                            logger.debug("Locking access...");
                            ReaderContext.lockTag(password, new LockAction(LockAction.EPC_LOCK), data);
                            statusLabel.setBackground(Color.yellow);
                            statusLabel.setText("EPC locked");
                            ReaderContext.lockTag(password, new LockAction(LockAction.ACCESS_LOCK), data);
                            statusLabel.setBackground(Color.yellow);
                            statusLabel.setText("ACCESS locked");
                            ReaderContext.lockTag(password, new LockAction(LockAction.KILL_LOCK), data);
                            statusLabel.setBackground(Color.yellow);
                            statusLabel.setText("KILL locked");
                            statusLabel.setBackground(Color.green);
                            statusLabel.setText("Tag bloqueado");
                        } catch (ReaderCodeException e) {
                            statusLabel.setBackground(Color.red);
                            statusLabel.setText("Error bloqueando");
                            JOptionPane.showMessageDialog(this, "Error de bloqueo " + e.getMessage(),
                                    "Error de bloqueo", JOptionPane.ERROR_MESSAGE);
                        }
                    } catch (NumberFormatException e) {
                        logger.warn("Invalid access code format " + e.getMessage());
                    }
                } else {

                }
            } catch (DecoderException e) {
                statusLabel.setBackground(Color.red);
                statusLabel.setText("Tag no programado");
                e.printStackTrace();
            }
        }
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(this, "El valor de chip debe ser numrico", "Error de datos",
                JOptionPane.ERROR_MESSAGE);
    } catch (SQLException e) {
        JOptionPane.showMessageDialog(this, "Error: " + e.getMessage(), "Error de base de datos",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.voterData.graph.Graph.java

public static JFreeChart getRaceDistbn2012(Map<String, Double> dataMap) {
    DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
    for (String key : dataMap.keySet()) {
        if (key.equals("A_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "REP");
        } else if (key.equals("B_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "REP");
        } else if (key.equals("I_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "REP");
        } else if (key.equals("O_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "REP");
        } else if (key.equals("M_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "REP");
        } else if (key.equals("U_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "REP");
        } else if (key.equals("W_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "REP");
        } else if (key.equals("A_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "DEM");
        } else if (key.equals("B_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "DEM");
        } else if (key.equals("I_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "DEM");
        } else if (key.equals("O_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "DEM");
        } else if (key.equals("M_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "DEM");
        } else if (key.equals("U_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "DEM");
        } else if (key.equals("W_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "DEM");
        } else if (key.equals("A_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "UNA");
        } else if (key.equals("B_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "UNA");
        } else if (key.equals("I_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "UNA");
        } else if (key.equals("O_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "UNA");
        } else if (key.equals("M_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "UNA");
        } else if (key.equals("U_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "UNA");
        } else if (key.equals("W_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "UNA");
        }//from www.  j a  v  a2 s .  c o  m
    }

    JFreeChart jfreechart = ChartFactory.createBarChart("Race Distribution - 2012", "Party", "% of votes",
            defaultcategorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();

    renderer.setDrawBarOutline(false);
    renderer.setSeriesPaint(0, Color.cyan);
    renderer.setSeriesPaint(1, Color.pink);
    renderer.setSeriesPaint(2, Color.red);
    renderer.setSeriesPaint(3, Color.orange);
    renderer.setSeriesPaint(4, Color.green);
    renderer.setSeriesPaint(5, Color.yellow);
    renderer.setSeriesPaint(6, Color.magenta);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
    renderer.setItemLabelsVisible(true);
    categoryplot.setRenderer(renderer);

    return jfreechart;

}

From source file:op.care.values.PnlValues.java

private JPanel createContentPanel4Year(final ResValueTypes vtype, final int year) {
    final String keyYears = vtype.getID() + ".xtypes." + Integer.toString(year) + ".year";

    java.util.List<ResValue> myValues;
    synchronized (mapType2Values) {
        if (!mapType2Values.containsKey(keyYears)) {
            mapType2Values.put(keyYears, ResValueTools.getResValues(resident, vtype, year));
        }//from w  ww .ja  v a2 s  . c o  m
        if (mapType2Values.get(keyYears).isEmpty()) {
            JLabel lbl = new JLabel(SYSTools.xx("misc.msg.novalue"));
            JPanel pnl = new JPanel();
            pnl.add(lbl);
            return pnl;
        }
        myValues = mapType2Values.get(keyYears);
    }

    JPanel pnlYear = new JPanel(new VerticalLayout());

    pnlYear.setOpaque(false);

    for (final ResValue resValue : myValues) {
        String title = "<html><table border=\"0\">" + "<tr>" + "<td width=\"200\" align=\"left\">"
                + DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT).format(resValue.getPit())
                + " [" + resValue.getID() + "]</td>" + "<td width=\"340\" align=\"left\">"
                + ResValueTools.getValueAsHTML(resValue) + "</td>" + "<td width=\"200\" align=\"left\">"
                + resValue.getUser().getFullname() + "</td>" + "</tr>" + "</table>" + "</html>";

        final DefaultCPTitle pnlTitle = new DefaultCPTitle(title, null);

        pnlTitle.getMain().setBackground(GUITools.blend(vtype.getColor(), Color.WHITE, 0.1f));
        pnlTitle.getMain().setOpaque(true);

        if (resValue.isObsolete()) {
            pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22eraser));
        }
        if (resValue.isReplacement()) {
            pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22edited));
        }
        if (!resValue.getText().trim().isEmpty()) {
            pnlTitle.getAdditionalIconPanel().add(new JLabel(SYSConst.icon22info));
        }
        if (pnlTitle.getAdditionalIconPanel().getComponentCount() > 0) {
            pnlTitle.getButton().addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    GUITools.showPopup(
                            GUITools.getHTMLPopup(pnlTitle.getButton(), ResValueTools.getInfoAsHTML(resValue)),
                            SwingConstants.NORTH);
                }
            });
        }

        if (!resValue.getAttachedFilesConnections().isEmpty()) {
            /***
             *      _     _         _____ _ _
             *     | |__ | |_ _ __ |  ___(_) | ___  ___
             *     | '_ \| __| '_ \| |_  | | |/ _ \/ __|
             *     | |_) | |_| | | |  _| | | |  __/\__ \
             *     |_.__/ \__|_| |_|_|   |_|_|\___||___/
             *
             */
            final JButton btnFiles = new JButton(
                    Integer.toString(resValue.getAttachedFilesConnections().size()), SYSConst.icon22greenStar);
            btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip"));
            btnFiles.setForeground(Color.BLUE);
            btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER);
            btnFiles.setFont(SYSConst.ARIAL18BOLD);
            btnFiles.setPressedIcon(SYSConst.icon22Pressed);
            btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnFiles.setAlignmentY(Component.TOP_ALIGNMENT);
            btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnFiles.setContentAreaFilled(false);
            btnFiles.setBorder(null);

            btnFiles.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    new DlgFiles(resValue, new Closure() {
                        @Override
                        public void execute(Object o) {
                            EntityManager em = OPDE.createEM();
                            final ResValue myValue = em.find(ResValue.class, resValue.getID());
                            em.close();

                            synchronized (mapType2Values) {
                                mapType2Values.get(keyYears).remove(resValue);
                                mapType2Values.get(keyYears).add(myValue);
                                Collections.sort(mapType2Values.get(keyYears));
                            }

                            createCP4Year(vtype, year);
                            buildPanel();
                        }
                    });
                }
            });
            btnFiles.setEnabled(OPDE.isFTPworking());
            pnlTitle.getRight().add(btnFiles);
        }

        if (!resValue.getAttachedProcessConnections().isEmpty()) {
            /***
             *      _     _         ____
             *     | |__ | |_ _ __ |  _ \ _ __ ___   ___ ___  ___ ___
             *     | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __|
             *     | |_) | |_| | | |  __/| | | (_) | (_|  __/\__ \__ \
             *     |_.__/ \__|_| |_|_|   |_|  \___/ \___\___||___/___/
             *
             */
            final JButton btnProcess = new JButton(
                    Integer.toString(resValue.getAttachedProcessConnections().size()), SYSConst.icon22redStar);
            btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip"));
            btnProcess.setForeground(Color.YELLOW);
            btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER);
            btnProcess.setFont(SYSConst.ARIAL18BOLD);
            btnProcess.setPressedIcon(SYSConst.icon22Pressed);
            btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnProcess.setAlignmentY(Component.TOP_ALIGNMENT);
            btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnProcess.setContentAreaFilled(false);
            btnProcess.setBorder(null);
            btnProcess.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    new DlgProcessAssign(resValue, new Closure() {
                        @Override
                        public void execute(Object o) {
                            if (o == null) {
                                return;
                            }
                            Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o;

                            ArrayList<QProcess> assigned = result.getFirst();
                            ArrayList<QProcess> unassigned = result.getSecond();

                            EntityManager em = OPDE.createEM();

                            try {
                                em.getTransaction().begin();

                                em.lock(em.merge(resident), LockModeType.OPTIMISTIC);
                                ResValue myValue = em.merge(resValue);
                                em.lock(myValue, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

                                ArrayList<SYSVAL2PROCESS> attached = new ArrayList<SYSVAL2PROCESS>(
                                        resValue.getAttachedProcessConnections());
                                for (SYSVAL2PROCESS linkObject : attached) {
                                    if (unassigned.contains(linkObject.getQProcess())) {
                                        linkObject.getQProcess().getAttachedNReportConnections()
                                                .remove(linkObject);
                                        linkObject.getResValue().getAttachedProcessConnections()
                                                .remove(linkObject);
                                        em.merge(new PReport(
                                                SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": "
                                                        + myValue.getTitle() + " ID: " + myValue.getID(),
                                                PReportTools.PREPORT_TYPE_REMOVE_ELEMENT,
                                                linkObject.getQProcess()));
                                        em.remove(linkObject);
                                    }
                                }
                                attached.clear();

                                for (QProcess qProcess : assigned) {
                                    java.util.List<QProcessElement> listElements = qProcess.getElements();
                                    if (!listElements.contains(myValue)) {
                                        QProcess myQProcess = em.merge(qProcess);
                                        SYSVAL2PROCESS myLinkObject = em
                                                .merge(new SYSVAL2PROCESS(myQProcess, myValue));
                                        em.merge(new PReport(
                                                SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": "
                                                        + myValue.getTitle() + " ID: " + myValue.getID(),
                                                PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess));
                                        qProcess.getAttachedResValueConnections().add(myLinkObject);
                                        myValue.getAttachedProcessConnections().add(myLinkObject);
                                    }
                                }

                                em.getTransaction().commit();

                                synchronized (mapType2Values) {
                                    mapType2Values.get(keyYears).remove(resValue);
                                    mapType2Values.get(keyYears).add(myValue);
                                    Collections.sort(mapType2Values.get(keyYears));
                                }
                                createCP4Year(vtype, year);

                                buildPanel();

                            } catch (OptimisticLockException ole) {
                                OPDE.warn(ole);
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                    OPDE.getMainframe().emptyFrame();
                                    OPDE.getMainframe().afterLogin();
                                }
                                OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                            } catch (RollbackException ole) {
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) {
                                    OPDE.getMainframe().emptyFrame();
                                    OPDE.getMainframe().afterLogin();
                                }
                                OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage());
                            } catch (Exception e) {
                                if (em.getTransaction().isActive()) {
                                    em.getTransaction().rollback();
                                }
                                OPDE.fatal(e);
                            } finally {
                                em.close();
                            }
                        }
                    });
                }
            });
            btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID));
            pnlTitle.getRight().add(btnProcess);
        }
        /***
         *      __  __
         *     |  \/  | ___ _ __  _   _
         *     | |\/| |/ _ \ '_ \| | | |
         *     | |  | |  __/ | | | |_| |
         *     |_|  |_|\___|_| |_|\__,_|
         *
         */
        final JButton btnMenu = new JButton(SYSConst.icon22menu);
        btnMenu.setPressedIcon(SYSConst.icon22Pressed);
        btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnMenu.setAlignmentY(Component.TOP_ALIGNMENT);
        btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnMenu.setContentAreaFilled(false);
        btnMenu.setBorder(null);
        btnMenu.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JidePopup popup = new JidePopup();
                popup.setMovable(false);
                popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS));
                popup.setOwner(btnMenu);
                popup.removeExcludedComponent(btnMenu);
                JPanel pnl = getMenu(resValue);
                popup.getContentPane().add(pnl);
                popup.setDefaultFocusComponent(pnl);

                GUITools.showPopup(popup, SwingConstants.WEST);
            }
        });
        btnMenu.setEnabled(!resValue.isObsolete());
        pnlTitle.getRight().add(btnMenu);

        pnlYear.add(pnlTitle.getMain());
        synchronized (linemap) {
            linemap.put(resValue, pnlTitle.getMain());
        }
    }
    return pnlYear;
}

From source file:edu.harvard.i2b2.patientMapping.ui.PatientMappingJPanel.java

private void jNameLabelMouseMoved(java.awt.event.MouseEvent evt) {
    jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(Color.YELLOW));
    jLabel1.paintImmediately(jLabel1.getVisibleRect());

    try {//  w w  w .ja  va  2 s  . c  o m
        Thread.sleep(500);
    } catch (InterruptedException e) {
    }

    jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(Color.BLACK));
}

From source file:op.FrmMain.java

public JScrollPane prepareSearchArea() {
    // fixes #1/*from   ww  w.  j  av  a 2s  .  co  m*/
    if (panesApps != null) {
        panesApps.removeAll();
    }
    for (CollapsiblePane cp : listOfNursingrecords) {
        cp.removeAll();
    }
    listOfNursingrecords.clear();

    panesSearch = new CollapsiblePanes();
    panesSearch.setLayout(new JideBoxLayout(panesSearch, JideBoxLayout.Y_AXIS));
    jspSearch = new JScrollPane(panesSearch);

    panesApps = new CollapsiblePanes();
    panesApps.setLayout(new JideBoxLayout(panesApps, JideBoxLayout.Y_AXIS));

    homeButton = GUITools.createHyperlinkButton(SYSTools.xx("opde.welcome"), SYSConst.icon22home,
            new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    if (previousProgButton != null) {
                        previousProgButton.setBackground(Color.WHITE);
                        previousProgButton.setOpaque(false);
                    }
                    currentResident = null;
                    previousProgButton = (JideButton) actionEvent.getSource();
                    previousProgButton.setBackground(Color.YELLOW);
                    previousProgButton.setOpaque(true);
                    displayManager.setMainMessage(SYSTools.xx("opde.welcome"));
                    displayManager
                            .addSubMessage(new DisplayMessage(SYSTools.xx("opde.welcome.longDescription")));
                    displayManager.clearAllIcons();
                    setPanelTo(new PnlWelcome(jspSearch));
                }
            });
    panesApps.add(homeButton);

    EntityManager em = OPDE.createEM();
    Query query = em.createQuery("SELECT s FROM Station s ORDER BY s.name");
    ArrayList<Station> stationen = new ArrayList<Station>(query.getResultList());
    em.close();
    for (Station station : stationen) {
        panesApps.add(addNursingRecords(station));
    }

    // May see the archive
    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.ARCHIVE, "nursingrecords.info")) {
        panesApps.add(addNursingRecords(null));
    }

    panesApps.addExpansion();
    jspApps = new myAppsScrollPane(panesApps);

    //        final int width = panesApps.getPreferredSize().width + 16;
    //        panesApps.addComponentListener(new ComponentAdapter() {
    //            @Override
    //            public void componentResized(ComponentEvent e) {
    //                SwingUtilities.invokeLater(new Runnable() {
    //                    @Override
    //                    public void run() {
    //                        panesApps.setPreferredSize(new Dimension(width, panesApps.getPreferredSize().height));
    //                        jspApps.revalidate();
    //                    }
    //                });
    //
    //
    //
    ////                super.componentResized(e);    //To change body of overridden methods use File | Settings | File Templates.
    ////                panesApps.setPreferredSize(new Dimension(width, panesApps.getPreferredSize().height));
    //
    //            }
    //        });

    splitPaneLeft.setOrientation(JideSplitPane.VERTICAL_SPLIT);
    splitPaneLeft.add(jspApps);
    splitPaneLeft.add(jspSearch);
    return jspSearch;
}

From source file:gov.nih.nci.ispy.ui.graphing.chart.plot.ISPYCorrelationScatterPlot.java

private Color getColorForIHCLevelResult(String result) {

    //OVEREXPRESSED,POSITIVE,HIGH
    String res = result.trim();/*w ww  . ja v a  2 s .c o m*/

    if (res.equalsIgnoreCase("OVEREXPRESSED") || res.equalsIgnoreCase("POSITIVE")
            || res.equalsIgnoreCase("HIGH")) {
        return Color.GREEN;
    }

    //INTERMEDIATE,BORDERLINE,LOW,WEAK OVEREXPRESSED
    if (res.equalsIgnoreCase("INTERMEDIATE") || res.equalsIgnoreCase("BORDERLINE")
            || res.equalsIgnoreCase("LOW") || res.equalsIgnoreCase("WEAK OVEREXPRESSED")) {
        return Color.YELLOW;
    }

    //NEGATIVE,NO OVEREXPRESSION, ZERO
    if (res.equalsIgnoreCase("NEGATIVE") || res.equalsIgnoreCase("NO OVEREXPRESSION")
            || res.equalsIgnoreCase("ZERO")) {
        return Color.RED;
    }

    return Color.GRAY;
}

From source file:gov.nih.nci.ispy.ui.graphing.chart.plot.ISPYCorrelationScatterPlot.java

private Color getColorForIHCLossResult(String result) {

    String res = result.trim();/*from  w  w  w.j a va 2 s . c o m*/

    //NO LOSS
    if (res.equalsIgnoreCase("NO LOSS")) {
        return Color.GREEN;
    }

    if (res.equalsIgnoreCase("PARTIAL LOSS")) {
        return Color.YELLOW;
    }
    //PARTIAL LOSS

    //TOTAL LOSS
    if (res.equalsIgnoreCase("TOTAL LOSS")) {
        return Color.BLUE;
    }

    return Color.GRAY;

}