Example usage for java.awt Color orange

List of usage examples for java.awt Color orange

Introduction

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

Prototype

Color orange

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

Click Source Link

Document

The color orange.

Usage

From source file:uk.co.modularaudio.mads.base.common.ampmeter.BIAmpMeter.java

private void refillMeterImage() {
    if (outBufferedImage != null) {
        outBufferedImageGraphics.setColor(Color.BLACK);
        outBufferedImageGraphics.fillRect(0, 0, componentWidth, componentHeight);

        final int meterWidth = AmpMeter.PREFERRED_METER_WIDTH;

        final int sliderIntValue = INT_TO_FLOAT_CONVERTER.floatValueToSliderIntValue(METER_MODEL,
                currentMeterValueDb);//from w  w w.j  av  a2  s . c  o  m
        final float normalisedlevelValue = (sliderIntValue / numTotalSteps);
        final int numPixelsHigh = (int) (normalisedlevelValue * numPixelsInMeter);

        outBufferedImageGraphics.setColor(Color.GREEN);
        final int greenBarHeightInPixels = (numPixelsHigh > numGreenPixels ? numGreenPixels : numPixelsHigh);

        final int greenStartY = numPixelsInMeter - greenBarHeightInPixels + 1 + meterHeightOffset;
        outBufferedImageGraphics.fillRect(3, greenStartY, meterWidth - 4, greenBarHeightInPixels);

        int pixelsLeft = numPixelsHigh - greenBarHeightInPixels;

        final int orangeBarHeightInPixels = (pixelsLeft > numOrangePixels ? numOrangePixels : pixelsLeft);

        final int orangeStartY = greenStartY - orangeBarHeightInPixels;
        if (orangeBarHeightInPixels > 0) {
            outBufferedImageGraphics.setColor(Color.ORANGE);
            outBufferedImageGraphics.fillRect(3, orangeStartY, meterWidth - 4, orangeBarHeightInPixels);
        }

        pixelsLeft -= orangeBarHeightInPixels;
        final int redBarHeightInPixels = (pixelsLeft > numRedPixels ? numRedPixels : pixelsLeft);

        if (redBarHeightInPixels > 0) {
            outBufferedImageGraphics.setColor(Color.RED);
            final int redStartY = orangeStartY - redBarHeightInPixels;
            outBufferedImageGraphics.fillRect(3, redStartY, meterWidth - 4, redBarHeightInPixels);
        }

        pixelsLeft -= redBarHeightInPixels;

        // Slightly larger bar across the top for the sticky max db
        final float maxNormalisedValue = (currentMaxValueDb >= 0.0f ? 1.0f
                : INT_TO_FLOAT_CONVERTER.toSliderIntFromDb(currentMaxValueDb) / numTotalSteps);
        final int maxBarPixelsHigh = (int) (maxNormalisedValue * numPixelsInMeter);
        final Color maxDbColor = getColorForDb(currentMaxValueDb);
        outBufferedImageGraphics.setColor(maxDbColor);

        final int yReverser = numPixelsInMeter + 1;
        final int maxStartY = yReverser - maxBarPixelsHigh + meterHeightOffset;
        outBufferedImageGraphics.drawLine(1, maxStartY, meterWidth, maxStartY);

        if (showClipBox) {
            if (currentMaxValueDb >= 0.0f) {
                // Should already be the right colour
                outBufferedImageGraphics.fillRect(1, 1, meterWidth, meterWidth - 1);
            }
        }
    }
}

From source file:mase.app.foraging.FlyingEffector.java

public void updateHeight() {
    ForagingTask ft = (ForagingTask) super.state;
    // Update flying bot sensors
    double vr = height > maxHeight ? 0 : height * FastMath.tan(ft.par.flyingVisionAngle / 2);
    for (Sensor sens : ((SmartAgent) ag).getSensors()) {
        if (sens instanceof DistanceSensorArcs) {
            DistanceSensorArcs dsa = (DistanceSensorArcs) sens;
            dsa.setRange(vr);//from   w w w.  j  a v a  2 s.co m
        }
    }

    // Update land bot sensors
    double lr = height > maxHeight ? 0 : height * FastMath.tan(ft.par.landVisionAngle / 2);
    DistanceSensorArcs sens = (DistanceSensorArcs) ft.landBot.getSensors().get(1);
    sens.setRange(lr);

    // Update apperance
    double newScale = MIN_SCALE
            + (ft.par.flyingRadius * 2 - MIN_SCALE) * ((-Math.min(height, maxHeight) + maxHeight) / maxHeight);
    OvalPortrayal2D child = (OvalPortrayal2D) ag.getChild(null);
    child.scale = newScale;
    if (height < 0.1) {
        child.paint = Color.BLACK;
    } else if (height > maxHeight) {
        child.paint = Color.ORANGE;
    } else {
        child.paint = FlyingRobot.COLOR;
    }
    if (height < 5) {
        ag.setCollidableTypes(EmboddiedAgent.class);
        ft.landBot.setCollidableTypes(EmboddiedAgent.class);
    } else {
        ag.setCollidableTypes();
        ft.landBot.setCollidableTypes();
    }

}

From source file:networkmonitor.MainIBMApplicationForm.java

/**
 * Creates a chart.//from ww w . ja va 2 s .co m
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart(

            // put a big space or it'll overlap with the statistics of data...  :) 
            "B/W Usage in KBps:                                                                    ", // chart title
            "Seconds                    ", // x axis label
            "  Usage", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, // Plot Orientation.. it means grap will show you statistics vertically 
            true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // Background color of chart/outside plot........
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    //plot background color inside the graph....
    plot.setBackgroundPaint(Color.orange); //org.jfree.chart.plot.XYPlot;
    //Plot vertical inner graph line.....
    plot.setDomainGridlinePaint(Color.red);
    //plot horizontal inner graph line.....
    plot.setRangeGridlinePaint(Color.blue);

    //Sets the renderer for the PGraphics object that is used for drawing to...
    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    // it used to show the up and down connecting line will show or not(RED LINE of graph)
    renderer.setSeriesLinesVisible(1, true);
    //renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);//it used to show the up and down block of data(RED Block Of GRAPH)

    //......................................... 

    //..... change the auto tick unit selection to integer units only
    //LIMIT OF X and Y axis GRAPH SIDE DATA (usages/second)
    //.....if I unhide these then only integer number show in X axis,it avoid floating point

    /*final NumberAxis domainAxis = new NumberAxis("X-Axis");
    domainAxis.setRange(0.00,1.00);
     domainAxis.setTickUnit(new NumberTickUnit(0.1));
     final NumberAxis rangeAxis = new NumberAxis("Y-Axis");
      rangeAxis.setRange(0.0,1.0);
     rangeAxis.setTickUnit(new NumberTickUnit(0.0));*/

    //usases(X axis) integer data counting
    //final NumberAxis rangeAxis = (NumberAxis) 
    //plot.getRangeAxis();
    //  rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.
    //..............................................

    return chart;
}

From source file:projekt.CustomRenderer.java

public void raport_lokalny() throws IOException, ClassNotFoundException, SQLException {

    loginController login = new loginController();
    String zapytanie = "select count(*) as Aktualne from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'Aktualne' and idUzytkownika = '"
            + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt";
    String zapytanie1 = "select count(*) as FORTEST from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'FORTEST' and idUzytkownika = '"
            + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt";
    String zapytanie2 = "select count(*) as Zakonczone from projekty, (SELECT Nazwa, Opis, Status_zadania, idUzytkownika,projekt from zadania where Status_zadania = 'Zakonczone' and idUzytkownika = '"
            + login.uzytkownikID + "') x where projekty.Nazwa = x.projekt";

    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pz?characterEncoding=utf8",
            "root", "");
    PreparedStatement statment;/*from w ww . ja v a2 s  .  co m*/
    ResultSet result;
    double odp = 0, odp1 = 0, odp2 = 0;
    statment = con.prepareStatement(zapytanie);
    result = statment.executeQuery();
    if (result.next()) {
        odp = result.getDouble("Aktualne");
    }
    statment = con.prepareStatement(zapytanie1);
    result = statment.executeQuery();
    if (result.next()) {
        odp1 = result.getDouble("FORTEST");
    }
    statment = con.prepareStatement(zapytanie2);
    result = statment.executeQuery();
    if (result.next()) {
        odp2 = result.getDouble("Zakonczone");
    }
    //tu tez zmienic na id
    statment = con.prepareStatement(
            "SELECT CONCAT(imie, ' ', nazwisko) as osoba from uzytkownicy WHERE idUzytkownika = '"
                    + login.uzytkownikID + "'");
    result = statment.executeQuery();
    String bbc = "";
    if (result.next()) {
        bbc = result.getString(1);
    }

    DefaultCategoryDataset set2 = new DefaultCategoryDataset();
    set2.setValue(odp, "", "Aktualne");
    set2.setValue(odp1, "", "FORTEST");
    set2.setValue(odp2, "", "Zakonczone");
    JFreeChart chart = ChartFactory.createBarChart(
            "Wszystkie zadania z projektow za ktore odpowiada " + result.getString(1), "Zadania", "Ilosc", set2,
            PlotOrientation.VERTICAL, false, true, false);

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

    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");

    renderer.setItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 45.0);
    renderer.setPositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ChartUtilities.writeChartAsJPEG(out, chart, 450, 600);
    DateFormat dataformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    DateFormat dataformat1 = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
    Date data = new Date();
    String fileName = "Raport lokalny " + dataformat1.format(data) + ".pdf";
    try {
        PDRectangle PAGE_SIZE = PDRectangle.A4;
        PDDocument doc = new PDDocument();
        PDFont font = PDType0Font.load(doc,
                getClass().getResourceAsStream("/fonts/RobotoCondensed-Regular.ttf"));
        PDFont font1 = PDType0Font.load(doc, getClass().getResourceAsStream("/fonts/RobotoCondensed-Bold.ttf"));
        PDPage page = new PDPage(PAGE_SIZE);
        PDPage page1 = new PDPage(PAGE_SIZE);
        doc.addPage(page);
        PDPageContentStream content = new PDPageContentStream(doc, page);
        //naglowek strona 1
        Naglowek1(content, dataformat, data);
        //stopka strona1
        Stopka(content, doc);
        content.beginText();
        content.setFont(font1, 48);
        content.moveTextPositionByAmount(135, 550);
        content.showText("Raport lokalny");
        content.endText();

        content.beginText();
        content.setFont(font, 22);
        content.moveTextPositionByAmount(30, 250);
        content.showText("Wersja systemu : 1.0");
        content.newLine();
        content.moveTextPositionByAmount(0, 35);
        content.showText("Autor raportu : " + result.getString("osoba"));
        content.endText();
        content.close();

        PDPageContentStream content1 = new PDPageContentStream(doc, page1);

        PDPage page2 = new PDPage(PAGE_SIZE);
        doc.addPage(page2);
        PDPageContentStream content2 = new PDPageContentStream(doc, page2);
        Naglowek1(content2, dataformat, data);
        //stopka strona2
        Stopka(content2, doc);
        content2.beginText();
        content2.setFont(font, 14);
        content2.moveTextPositionByAmount(30, 775);
        content2.showText("Wszystkie projekty za ktre odpowiada: " + result.getString(1));
        statment = con.prepareStatement(
                "Select Nazwa, Opis, Poczatek, Koniec, ludzie from projekty where idUzytkownika='"
                        + login.uzytkownikID + "'");
        result = statment.executeQuery();
        content2.newLine();
        int liczba = 615;
        content2.moveTextPositionByAmount(0, -15);
        while (result.next()) {
            content2.newLine();
            content2.moveTextPositionByAmount(0, -22);
            liczba += 22;
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));

            content2.showText("Nazwa : " + result.getString("Nazwa") + " Opis: " + result.getString(1));
            content2.newLine();
            content2.moveTextPositionByAmount(0, -17);
            liczba += 22;
            content2.showText("Data rozpoczecia: " + result.getString("Poczatek") + " Data zakonczenia: "
                    + result.getString("Koniec"));

        }
        content2.endText();
        //          content2.setLineWidth(2);
        //        content2.moveTo(10, liczba + 5);
        //        content2.lineTo(10, liczba +5);
        //        content2.closeAndStroke();
        DateFormat dataformat2 = new SimpleDateFormat("yyyy-MM-dd");
        statment = con.prepareStatement("Select count(*) as 'Aktualne' from projekty where Koniec > '"
                + dataformat2.format(data) + "' and idUzytkownika='" + login.uzytkownikID + "'");
        result = statment.executeQuery();
        int aktualne = 0, zakonczone = 0;
        if (result.next()) {
            aktualne = result.getInt("Aktualne");
        }
        statment = con.prepareStatement("Select count(*) as 'Zakonczone' from projekty where Koniec < '"
                + dataformat2.format(data) + "' and idUzytkownika='" + login.uzytkownikID + "'");
        result = statment.executeQuery();
        if (result.next()) {
            zakonczone = result.getInt("Zakonczone");
        }

        DefaultPieDataset pieDataset = new DefaultPieDataset();
        pieDataset.setValue("Aktualne", aktualne);
        pieDataset.setValue("Zakonczone", zakonczone);
        JFreeChart chart1 = ChartFactory.createPieChart("Zestawienia projekt za ktore odpowiada" + bbc, // Title
                pieDataset, // Dataset
                true, // Show legend
                true, // Use tooltips
                false // Configure chart to generate URLs?
        );

        PiePlot plot1 = (PiePlot) chart1.getPlot();
        plot1.setSectionPaint("Aktualne", Color.blue);
        plot1.setSectionPaint("Zakonczone", Color.yellow);
        plot1.setExplodePercent("Aktualne", 0.10);
        plot1.setSimpleLabels(true);

        PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot1.setLabelGenerator(gen);

        ByteArrayOutputStream out1 = new ByteArrayOutputStream();
        ChartUtilities.writeChartAsJPEG(out1, chart1, 450, 600);
        PDImageXObject img1 = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out1.toByteArray()));

        content2.close();
        PDPage page3 = new PDPage(PAGE_SIZE);
        doc.addPage(page3);
        PDPageContentStream content3 = new PDPageContentStream(doc, page3);
        Naglowek1(content3, dataformat, data);
        //stopka strona2
        Stopka(content3, doc);
        content3.drawImage(img1, 50, 50);
        content3.close();
        PDPage page4 = new PDPage(PAGE_SIZE);
        doc.addPage(page4);
        PDPageContentStream content4 = new PDPageContentStream(doc, page4);
        Naglowek1(content4, dataformat, data);
        //stopka strona2
        Stopka(content4, doc);
        content4.beginText();
        content4.setFont(font, 14);
        content4.moveTextPositionByAmount(30, 780);
        content4.showText("Wszystkie zadania w projektach za ktore odpowiada:" + bbc);
        statment = con.prepareStatement(
                "SELECT zadania.Nazwa,zadania.Opis,zadania.Status_zadania,zadania.projekt, z.Imie, z.Nazwisko,CONCAT(y.imie, ' ' , y.nazwisko) as 'UZY' FROM zadania , (select Nazwa from projekty where idUzytkownika = '"
                        + login.uzytkownikID
                        + "') x, (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) y,(SELECT imie, nazwisko, idUzytkownika from uzytkownicy where idUzytkownika = '"
                        + login.uzytkownikID + "') z WHERE zadania.projekt = x.Nazwa LIMIT 12"); //poprawic
        result = statment.executeQuery();
        content4.newLine();
        int nw = 850;
        content4.moveTextPositionByAmount(0, -15);
        nw -= 15;
        while (result.next()) {
            content4.newLine();
            nw -= 22;
            content4.moveTextPositionByAmount(0, -22);
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));
            content4.showText("Nazwa : " + result.getString("zadania.Nazwa"));
            content4.newLine();
            nw -= 17;
            content4.moveTextPositionByAmount(0, -17);
            content4.showText(" Opis: " + result.getString("zadania.Opis") + " Status zadania: "
                    + result.getString("zadania.Status_zadania"));
            content4.newLine();
            nw -= 17;
            content4.moveTextPositionByAmount(0, -17);
            content4.showText(" Projekt: " + result.getString("zadania.projekt")
                    + " Przydzielona osoba do zadania: " + result.getString("UZY"));

        }

        content4.endText();
        content4.close();
        statment = con.prepareStatement(
                "SELECT count(*) as 'liczba' FROM `zadania` where idUzytkownika='" + login.uzytkownikID + "'"); //poprawic
        result = statment.executeQuery();
        if (result.next()) {
        }
        statment = con.prepareStatement(
                "SELECT zadania.Nazwa,zadania.Opis,zadania.Status_zadania,zadania.projekt, z.Imie, z.Nazwisko,CONCAT(y.imie, \" \", y.nazwisko) as \"UZY\" FROM zadania , (select Nazwa from projekty where idUzytkownika = '"
                        + login.uzytkownikID
                        + "') x, (SELECT imie, nazwisko, idUzytkownika from uzytkownicy) y,(SELECT imie, nazwisko, idUzytkownika from uzytkownicy where idUzytkownika = '"
                        + login.uzytkownikID + "') z WHERE zadania.projekt = x.Nazwa LIMIT 12,"
                        + result.getInt(1) + "");
        result = statment.executeQuery();
        PDPage page5 = new PDPage(PAGE_SIZE);
        doc.addPage(page5);
        PDPageContentStream content5 = new PDPageContentStream(doc, page5);
        Naglowek1(content5, dataformat, data);
        //stopka strona2
        Stopka(content5, doc);
        content5.beginText();
        content5.setFont(font, 14);
        content5.moveTextPositionByAmount(30, 700);
        while (result.next()) {
            content5.newLine();
            nw -= 22;
            content5.moveTextPositionByAmount(0, -22);
            //content2.showText("Nazwa : "+result.getString("Nazwa")+" Opis: "+result.getString("Opis")+" Data rozpoczecia: "+result.getString("Poczatek")+" Data zakonczenia: "+result.getString("Koniec"));
            content5.showText("Nazwa : " + result.getString("zadania.Nazwa"));
            content5.newLine();
            nw -= 17;
            content5.moveTextPositionByAmount(0, -17);
            content5.showText(" Opis: " + result.getString("zadania.Opis") + " Status zadania: "
                    + result.getString("zadania.Status_zadania"));
            content5.newLine();
            nw -= 17;
            content5.moveTextPositionByAmount(0, -17);
            content5.showText(" Projekt: " + result.getString("zadania.projekt")
                    + " Przydzielona osoba do zadania: " + result.getString("UZY"));
        }
        content5.endText();
        content5.close();
        doc.addPage(page1);
        //naglowek strona 2
        Naglowek1(content1, dataformat, data);
        //stopka strona2
        Stopka(content1, doc);
        PDImageXObject img = JPEGFactory.createFromStream(doc, new ByteArrayInputStream(out.toByteArray()));
        content1.drawImage(img, 50, 50);
        content1.close();
        doc.save(fileName);
        doc.close();

    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
}

From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java

/**
 * Converts a java Color object into a friendly and readable LaTeX/xcolor string.
 *
 * @param   color    in color./*from  w  ww.  ja va 2s.  co m*/
 * @return           friendly color with string format as possible, null otherwise.
 */
protected static String detectXColorClassic(Color color) {
    String retour = null;

    int red = color.getRed();
    int green = color.getGreen();
    int blue = color.getBlue();

    // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha
    if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen())
        return "green";
    else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen())
        return "red";
    else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen())
        return "white";
    else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen())
        return "gray";
    else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen())
        return "black";
    else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen())
        return "yellow";
    else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue()
            && green == Color.MAGENTA.getGreen())
        return "magenta";
    else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen())
        return "cyan";
    else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen())
        return "blue";
    else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue()
            && green == Color.DARK_GRAY.getGreen())
        return "darkgray";
    else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue()
            && green == Color.LIGHT_GRAY.getGreen())
        return "lightgray";
    else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen())
        return "orange";
    else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen())
        return "pink";

    if (red == 192 && blue == 128 && green == 64)
        return "brown";
    else if (red == 128 && blue == 128 && green == 0)
        return "olive";
    else if (red == 128 && blue == 0 && green == 128)
        return "violet";
    else if (red == 192 && blue == 0 && green == 64)
        return "purple";
    else
        return null;
}

From source file:org.etudes.jforum.util.Captcha.java

protected void buildInitialFactories() {
    this.backgroundGeneratorList = new ArrayList();
    this.textPasterList = new ArrayList();
    this.fontGeneratorList = new ArrayList();

    int width = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_WIDTH);
    int height = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_HEIGHT);
    int minWords = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_MIN_WORDS);
    int maxWords = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_MAX_WORDS);
    int minFontSize = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_MIN_FONT_SIZE);
    int maxFontSize = SystemGlobals.getIntValue(ConfigKeys.CAPTCHA_MAX_FONT_SIZE);

    this.backgroundGeneratorList.add(
            new GradientBackgroundGenerator(new Integer(width), new Integer(height), Color.BLACK, Color.GRAY));
    this.backgroundGeneratorList.add(new FunkyBackgroundGenerator(new Integer(250), new Integer(50)));

    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.RED));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.ORANGE));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.BLUE));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.WHITE));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.GREEN));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.GRAY));
    this.textPasterList.add(new RandomTextPaster(new Integer(minWords), new Integer(maxWords), Color.YELLOW));

    this.fontGeneratorList
            .add(new TwistedAndShearedRandomFontGenerator(new Integer(minFontSize), new Integer(maxFontSize)));

    // Create a random word generator
    WordGenerator words = new RandomWordGenerator(charsInUse);

    for (Iterator fontIter = this.fontGeneratorList.iterator(); fontIter.hasNext();) {
        FontGenerator fontGeny = (FontGenerator) fontIter.next();

        for (Iterator backIter = this.backgroundGeneratorList.iterator(); backIter.hasNext();) {
            BackgroundGenerator bkgdGeny = (BackgroundGenerator) backIter.next();

            for (Iterator textIter = this.textPasterList.iterator(); textIter.hasNext();) {
                TextPaster textPaster = (TextPaster) textIter.next();

                WordToImage word2image = new ComposedWordToImage(fontGeny, bkgdGeny, textPaster);

                // Creates a ImageCaptcha Factory
                ImageCaptchaFactory factory = new GimpyFactory(words, word2image);

                // Add a factory to the gimpy list (A Gimpy is a ImagCaptcha)
                addFactory(factory);/*from w ww .j a  v  a 2s .  c o  m*/
            }
        }
    }

}

From source file:org.hydra.ui.gui.HistoryVisualization.java

/**
 * Sets up the graphical rendering context which will be applied to the
 * graphical represenation./*from  ww  w. j av a  2 s  .  co  m*/
 * 
 * @param renderContext
 *            RenderContext.
 * @param renderer
 *            Renderer.
 */
private void setupRendering(final RenderContext renderContext, final Renderer renderer) {
    // Label Vertexes
    renderContext.setVertexLabelTransformer(new ToStringLabeller());
    renderContext.setEdgeLabelTransformer(new ToStringLabeller());
    renderer.getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    // Color Nodes (System Path, Valid Path and Current)
    final Transformer<GraphNode, Paint> vertexPaintTransformer = new Transformer<GraphNode, Paint>() {
        @Override
        public Paint transform(final GraphNode graphNode) {
            if (graphNode.isCurrent())
                return Color.ORANGE;
            else if (graphNode.isValidPath())
                return Color.GREEN;
            else
                return Color.RED;
        }
    };
    renderContext.setVertexFillPaintTransformer(vertexPaintTransformer);
}

From source file:org.geopublishing.atlasStyler.classification.FeatureClassification.java

@Override
public BufferedImage createHistogramImage(boolean showMean, boolean showSd, int histogramBins,
        String label_xachsis) throws InterruptedException, IOException {
    HistogramDataset hds = new HistogramDataset();
    DoubleArrayList valuesAL;//from   w w  w.ja v  a  2  s .  c o  m
    valuesAL = getStatistics().elements();
    // new double[] {0.4,3,4,2,5.,22.,4.,2.,33.,12.}
    double[] elements = Arrays.copyOf(valuesAL.elements(), getStatistics().size());
    hds.addSeries(1, elements, histogramBins);

    /** Statically label the Y Axis **/
    String label_yachsis = ASUtil.R("QuantitiesClassificationGUI.Histogram.YAxisLabel");

    JFreeChart chart = org.jfree.chart.ChartFactory.createHistogram(null, label_xachsis, label_yachsis, hds,
            PlotOrientation.VERTICAL, false, true, true);

    /***********************************************************************
     * Paint the classes into the JFreeChart
     */
    int countLimits = 0;
    for (Double cLimit : getClassLimits()) {
        ValueMarker marker = new ValueMarker(cLimit);
        XYPlot plot = chart.getXYPlot();
        marker.setPaint(Color.orange);
        marker.setLabel(String.valueOf(countLimits));
        marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
        marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
        plot.addDomainMarker(marker);

        countLimits++;
    }

    /***********************************************************************
     * Optionally painting SD and MEAN into the histogram
     */
    try {
        if (showSd) {
            ValueMarker marker;
            marker = new ValueMarker(getStatistics().standardDeviation(), Color.green.brighter(),
                    new BasicStroke(1.5f));
            XYPlot plot = chart.getXYPlot();
            marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.SD.ShortLabel"));
            marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
            marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
            plot.addDomainMarker(marker);
        }

        if (showMean) {
            ValueMarker marker;
            marker = new ValueMarker(getStatistics().mean(), Color.green.darker(), new BasicStroke(1.5f));
            XYPlot plot = chart.getXYPlot();
            marker.setLabel(ASUtil.R("QuantitiesClassificationGUI.Histogram.Mean.ShortLabel"));
            marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
            marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
            plot.addDomainMarker(marker);
        }

    } catch (Exception e) {
        LOGGER.error("Painting SD and MEAN into the histogram", e);
    }

    /***********************************************************************
     * Render the Chart
     */
    BufferedImage image = chart.createBufferedImage(400, 200);

    return image;
}

From source file:cytoscape.render.immed.GraphGraphicsTest.java

private long drawCurrentFull(Random rand) {
    final float nodeSizeFactor = 50f;
    float size = (float) canvasSize;

    long begin = System.nanoTime();
    for (int i = 0; i < numNodes; i++) {
        float x = rand.nextFloat() * (rand.nextBoolean() ? size : -size);
        float y = rand.nextFloat() * (rand.nextBoolean() ? size : -size);
        currentGraphGraphics.drawNodeFull((byte) (i % (int) GraphGraphics.s_last_shape), x, y,
                (x + (rand.nextFloat() * nodeSizeFactor)), (y + (rand.nextFloat() * nodeSizeFactor)),
                Color.blue, 1.0f + (i % 10), Color.yellow);
    }/* w w  w. j a v  a 2s. c o m*/
    long end = System.nanoTime();
    long nodeDur = end - begin;

    BasicStroke edgeStroke = new BasicStroke(1f);

    begin = System.nanoTime();
    for (int i = 0; i < numEdges; i++) {
        currentGraphGraphics.drawEdgeFull((byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.red,
                (byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.orange,
                rand.nextFloat() * (rand.nextBoolean() ? size : -size),
                rand.nextFloat() * (rand.nextBoolean() ? size : -size), currentGraphGraphics.m_noAnchors,
                rand.nextFloat() * (rand.nextBoolean() ? size : -size),
                rand.nextFloat() * (rand.nextBoolean() ? size : -size), 1f, edgeStroke, Color.green);
    }
    end = System.nanoTime();
    long duration = (end - begin) + nodeDur;

    //      try {
    //         ImageIO.write(image,"PNG",new File("/tmp/homer-current-" + rand.nextInt(100) + ".png"));
    //      } catch (IOException ioe) { ioe.printStackTrace(); }
    return duration;
}

From source file:org.jfree.chart.demo.LegendManiaDemo.java

/**
 * Creates a sample chart.//from w w  w . j av a2s  . com
 * 
 * @param dataset
 *           the dataset.
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart(CHART_TITLE, // chart title
            "Activity", // domain axis label
            "Rate", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(new Color(255, 255, 180));

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(BACKGROUND_PAINT);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    final StandardLegend legend = (StandardLegend) chart.getLegend();
    legend.setBackgroundPaint(Color.orange);
    legend.setOutlinePaint(Color.orange);

    // activate word wrapping when legend is vertical.
    legend.setPreferredWidth(125);

    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}