Example usage for java.awt Color magenta

List of usage examples for java.awt Color magenta

Introduction

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

Prototype

Color magenta

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

Click Source Link

Document

The color magenta.

Usage

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

/**
 * Creates a new demo.//from  w  w w.j  a  v a 2  s .  c o  m
 *
 * @param title  the frame title.
 */
public XYStepAreaChartDemo(final String title) {

    super(title);

    this.xySeries = new XYSeries("Some data");
    for (int i = 0; i < TEST_DATA.length; i++) {
        this.xySeries.add((Integer) TEST_DATA[i][0], (Integer) TEST_DATA[i][1]);
    }

    final XYSeriesCollection dataset = new XYSeriesCollection(this.xySeries);

    final JFreeChart chart = createChart(dataset);

    this.chartPanel = new ChartPanel(chart);

    // allow zooming
    //        this.chartPanel.setHorizontalZoom(true);
    //        this.chartPanel.setVerticalZoom(true);

    // size
    this.chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    // make stroke more striking
    final Plot plot = this.chartPanel.getChart().getPlot();
    plot.setOutlineStroke(new BasicStroke(2));
    plot.setOutlinePaint(Color.magenta);

    // add some components to make options changable
    final JPanel main = new JPanel(new BorderLayout());
    final JPanel optionsPanel = new JPanel();

    final String[] options = { ORIENT_VERT, ORIENT_HORIZ };
    this.orientationComboBox = new JComboBox(options);
    this.orientationComboBox.addActionListener(this);
    optionsPanel.add(this.orientationComboBox);

    this.outlineCheckBox = new JCheckBox("Outline");
    this.outlineCheckBox.addActionListener(this);
    optionsPanel.add(this.outlineCheckBox);

    optionsPanel.add(new JLabel("Base"));
    this.rangeBaseTextField = new JTextField("0", 5);
    this.rangeBaseTextField.addActionListener(this);
    optionsPanel.add(this.rangeBaseTextField);

    this.nullValuesCheckBox = new JCheckBox("NULL values");
    this.nullValuesCheckBox.addActionListener(this);
    optionsPanel.add(this.nullValuesCheckBox);

    main.add(optionsPanel, BorderLayout.SOUTH);
    main.add(this.chartPanel);
    setContentPane(main);
}

From source file:com.mugarov.neview.view.GraphPanel.java

public void setValues(ArrayList<DotBag> dotBags, ArrayList<Median> lines, String name) {

    CoordinateSeries ser;/*  w  w w  . ja v  a2  s. com*/
    for (DotBag db : dotBags) {

        ser = new CoordinateSeries(db.getName());
        for (Dot d : db) {

            ser.add(d.getCoordinates(), d.getName(), d.getScaffoldName());
            //                System.out.println("New dot:"+d.getLogX()+", "+d.getLogY());
        }

        this.dotSeries.add(ser);
    }

    for (Median med : lines) {
        ser = new CoordinateSeries(med.getName());

        ser.add(med.getStart(), med.getName(), null);
        ser.add(med.getEnd(), med.getName(), null);
        //            System.out.println("New line from " + med.getStart().getX()+","+ med.getStart().getY()+" to "+med.getEnd().getX()+","+ med.getEnd().getY());
        this.lineSeries.add(ser);
    }

    this.seriesCollection = new CoordinateSeriesCollection();

    for (CoordinateSeries dotSeries : this.dotSeries) {
        this.seriesCollection.addSeries(dotSeries);
    }
    for (CoordinateSeries line : this.lineSeries) {
        this.seriesCollection.addSeries(line);
    }

    this.chart = ChartFactory.createXYLineChart(name, GraphPanel.XAxis, GraphPanel.YAxis, this.seriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    this.chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();

    ExpAxis x1Axis = new ExpAxis(GraphPanel.XAxis);
    ExpAxis y1Axis = new ExpAxis(GraphPanel.YAxis);

    NumberAxis x2Axis = new NumberAxis("Proportion to max of " + GraphPanel.XAxis);
    NumberAxis y2Axis = new NumberAxis("Proportion to max of " + GraphPanel.YAxis);

    plot.setDomainAxis(0, x1Axis);
    plot.setDomainAxis(1, x2Axis);
    plot.setRangeAxis(0, y1Axis);
    plot.setRangeAxis(1, y2Axis);
    //        plot.setDomainAxis(1, yAxis);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

    for (int i = 0; i < this.dotSeries.size(); i++) {
        renderer.setSeriesLinesVisible(i, false);
        renderer.setSeriesPaint(i, this.colorGen.get(i));
    }

    for (int i = this.dotSeries.size(); i < this.lineSeries.size() + this.dotSeries.size(); i++) {
        renderer.setSeriesShapesVisible(i, false);
        //             renderer.setSeriesPaint(i, Color.black);
        renderer.setSeriesPaint(i, this.colorGen.get(i - this.dotSeries.size()));
    }

    renderer.setBaseToolTipGenerator(new ItemGenerator());

    plot.setRenderer(renderer);
    plot.setBackgroundPaint(Color.white);

    plot.setDomainGridlinePaint(Color.MAGENTA);
    plot.setRangeGridlinePaint(Color.MAGENTA);

    boolean add = (this.chartPanel == null);
    this.chartPanel = new ChartPanel(chart);

    if (add) {
        this.content.add(this.chartPanel, BorderLayout.CENTER);
        this.scroll.setViewportView(this.chartPanel);
    }

    this.setBackground(Color.green);
    this.chartPanel.setBackground(Color.MAGENTA);
    this.updateUI();
}

From source file:j2se.jfreechart.barchart.BarChartDemo3.java

/**
 * Creates a sample chart.//from   ww w . ja v  a  2 s.  c  o m
 * 
 * @param dataset  the dataset.
 * 
 * @return a sample chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 3", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            false, // include legend
            true, false);

    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");

    final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });
    //        renderer.setLabelGenerator(new StandardCategoryLabelGenerator());
    renderer.setItemLabelsVisible(true);
    final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 45.0);
    renderer.setPositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    // change the margin at the top of the range axis...
    final ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    return chart;

}

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 w  w. ja v  a 2 s.  c om*/
 * @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:com.att.aro.ui.view.diagnostictab.plot.NetworkTypePlot.java

private void setRenderingColorForDataSeries(XYItemRenderer renderer,
        final XYIntervalSeriesCollection dataSeries) {
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.none), Color.WHITE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.LTE), Color.RED);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.WIFI), Color.BLUE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.UMTS), Color.PINK);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.ETHERNET), Color.BLACK);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSDPA), Color.YELLOW);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPA), Color.ORANGE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPAP), Color.MAGENTA);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSUPA), Color.CYAN);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.GPRS), Color.GRAY);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.EDGE), Color.LIGHT_GRAY);
}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo9.java

/**
 * Returns an array of paint objects that will be used for the bar colors.
 * //from   ww  w .  ja  v  a 2 s  . c  o  m
 * @return An array of paint objects.
 */
private static Paint[] createPaint() {
    Paint[] colors = new Paint[5];
    colors[0] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.red);
    colors[1] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.green);
    colors[2] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.blue);
    colors[3] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.orange);
    colors[4] = new GradientPaint(0f, 0f, Color.white, 0f, 0f, Color.magenta);
    return colors;
}

From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java

protected static String detectXColorClassic(Color color) {
    String retour = null;//from  w w w.j a  v a2s.  c o  m

    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: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;// w w w  .  j  av  a  2  s .c o 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:com.planetmayo.debrief.satc.util.StraightLineCullingTestForm.java

private void drawResultLineAndPolygon(int num, Coordinate[] line, Geometry geometry) {
    XYItemRenderer renderer = ((XYPlot) chart.getPlot()).getRenderer();

    XYSeries lineSeries = new XYSeries("line " + num);
    lineSeries.add(line[0].x, line[0].y);
    lineSeries.add(line[1].x, line[1].y);
    collections.addSeries(lineSeries);/*  www .j  a va  2  s  .  co m*/

    XYSeries polygonSeries = new XYSeries("result " + num, false);
    for (Coordinate c : geometry.getCoordinates()) {
        polygonSeries.add(c.x, c.y);
    }
    collections.addSeries(polygonSeries);

    renderer.setSeriesPaint(collections.getSeriesCount() - 2, Color.MAGENTA);
    renderer.setSeriesStroke(collections.getSeriesCount() - 2, new BasicStroke(1.0f));
    renderer.setSeriesPaint(collections.getSeriesCount() - 1, Color.BLACK);
    renderer.setSeriesStroke(collections.getSeriesCount() - 1, new BasicStroke(3.0f));
}

From source file:edu.ucsf.valelab.spotintensityanalysis.plot.PlotUtils.java

/**
 * Create a frame with a plot of the data given in XYSeries overwrite any
 * previously created frame with the same title
 *
        // ww w .j  av a 2 s.c  om
 * @param title shown in the top of the plot
 * @param data array with data series to be plotted
 * @param xTitle Title of the X axis
 * @param yTitle Title of the Y axis
 * @param showShapes whether or not to draw shapes at the data points
 * @param annotation to be shown in plot
 * @return Frame that displays the data
 */
public Frame plotDataN(String title, XYSeries[] data, String xTitle, String yTitle, boolean[] showShapes,
        String annotation) {

    // JFreeChart code
    XYSeriesCollection dataset = new XYSeriesCollection();
    // calculate min and max to scale the graph
    double minX, minY, maxX, maxY;
    minX = data[0].getMinX();
    minY = data[0].getMinY();
    maxX = data[0].getMaxX();
    maxY = data[0].getMaxY();
    for (XYSeries d : data) {
        dataset.addSeries(d);
        if (d.getMinX() < minX) {
            minX = d.getMinX();
        }
        if (d.getMaxX() > maxX) {
            maxX = d.getMaxX();
        }
        if (d.getMinY() < minY) {
            minY = d.getMinY();
        }
        if (d.getMaxY() > maxY) {
            maxY = d.getMaxY();
        }
    }

    JFreeChart chart = ChartFactory.createScatterPlot(title, // Title
            xTitle, // x-axis Label
            yTitle, // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);

    for (int i = 0; i < data.length; i++) {
        renderer.setSeriesFillPaint(i, Color.white);
        renderer.setSeriesLinesVisible(i, true);
    }

    renderer.setSeriesPaint(0, Color.blue);
    Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
    renderer.setSeriesShape(0, circle, false);

    if (data.length > 1) {
        renderer.setSeriesPaint(1, Color.red);
        Shape square = new Rectangle2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
        renderer.setSeriesShape(1, square, false);
    }
    if (data.length > 2) {
        renderer.setSeriesPaint(2, Color.darkGray);
        Shape rect = new Rectangle2D.Float(-2.0f, -1.0f, 4.0f, 2.0f);
        renderer.setSeriesShape(2, rect, false);
    }
    if (data.length > 3) {
        renderer.setSeriesPaint(3, Color.magenta);
        Shape rect = new Rectangle2D.Float(-1.0f, -2.0f, 2.0f, 4.0f);
        renderer.setSeriesShape(3, rect, false);
    }

    for (int i = 0; i < data.length; i++) {
        if (showShapes.length > i && !showShapes[i]) {
            renderer.setSeriesShapesVisible(i, false);
        }
    }

    // place annotation at 80 % of max X, maxY
    XYAnnotation an = new XYTextAnnotation(annotation, maxX - 0.2 * (maxX - minX), maxY);
    plot.addAnnotation(an);

    renderer.setUseFillPaint(true);

    if (graphFrame_ == null)
        graphFrame_ = new MyChartFrame(title, chart);
    else
        graphFrame_.getChartPanel().setChart(chart);
    graphFrame_.getChartPanel().setMouseWheelEnabled(true);
    graphFrame_.pack();
    final MyChartFrame privateFrame = graphFrame_;
    graphFrame_.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent arg0) {
            privateFrame.dispose();
        }
    });

    graphFrame_.setVisible(true);

    return graphFrame_;
}