Example usage for java.awt Color RED

List of usage examples for java.awt Color RED

Introduction

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

Prototype

Color RED

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

Click Source Link

Document

The color red.

Usage

From source file:wsattacker.plugin.intelligentdos.ui.helper.ChartHelper.java

public static JFreeChart createOverlaidChart(SuccessfulAttack sa) {

    // create subplot 1...
    final XYSeries data1 = createDatasetResponseTime(RequestType.UNTAMPERED, sa.getUntamperedMetrics());
    final XYSeries data2 = createDatasetResponseTime(RequestType.TAMPERED, sa.getTamperedMetrics());
    final XYSeries data3 = createDatasetResponseTime(RequestType.TESTPROBES, sa.getTestProbes());

    final XYSeriesCollection collection = new XYSeriesCollection();
    collection.addSeries(data1);/*from w w w  .  j  av  a  2 s . c  o m*/
    collection.addSeries(data2);
    collection.addSeries(data3);

    final XYItemRenderer renderer = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("duration in ms");
    final XYPlot plot = new XYPlot(collection, new NumberAxis(""), rangeAxis1, renderer);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    renderer.setSeriesPaint(0, Color.GREEN);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesPaint(2, Color.BLUE);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
}

From source file:Clock.java

public void paint(Graphics g) {
    int xhour, yhour, xminute, yminute, xsecond, ysecond, second, minute, hour;
    drawStructure(g);/*from w  w w  .  ja  va  2s .  c  o  m*/

    currentDate = new Date();

    formatter.applyPattern("s");
    second = Integer.parseInt(formatter.format(currentDate));
    formatter.applyPattern("m");
    minute = Integer.parseInt(formatter.format(currentDate));

    formatter.applyPattern("h");
    hour = Integer.parseInt(formatter.format(currentDate));

    xsecond = (int) (Math.cos(second * 3.14f / 30 - 3.14f / 2) * 45 + xcenter);
    ysecond = (int) (Math.sin(second * 3.14f / 30 - 3.14f / 2) * 45 + ycenter);
    xminute = (int) (Math.cos(minute * 3.14f / 30 - 3.14f / 2) * 40 + xcenter);
    yminute = (int) (Math.sin(minute * 3.14f / 30 - 3.14f / 2) * 40 + ycenter);
    xhour = (int) (Math.cos((hour * 30 + minute / 2) * 3.14f / 180 - 3.14f / 2) * 30 + xcenter);
    yhour = (int) (Math.sin((hour * 30 + minute / 2) * 3.14f / 180 - 3.14f / 2) * 30 + ycenter);

    // Erase if necessary, and redraw
    g.setColor(Color.lightGray);
    if (xsecond != lastxs || ysecond != lastys) {
        g.drawLine(xcenter, ycenter, lastxs, lastys);
    }
    if (xminute != lastxm || yminute != lastym) {
        g.drawLine(xcenter, ycenter - 1, lastxm, lastym);
        g.drawLine(xcenter - 1, ycenter, lastxm, lastym);
    }
    if (xhour != lastxh || yhour != lastyh) {
        g.drawLine(xcenter, ycenter - 1, lastxh, lastyh);
        g.drawLine(xcenter - 1, ycenter, lastxh, lastyh);
    }

    g.setColor(Color.darkGray);
    g.drawLine(xcenter, ycenter, xsecond, ysecond);

    g.setColor(Color.red);
    g.drawLine(xcenter, ycenter - 1, xminute, yminute);
    g.drawLine(xcenter - 1, ycenter, xminute, yminute);
    g.drawLine(xcenter, ycenter - 1, xhour, yhour);
    g.drawLine(xcenter - 1, ycenter, xhour, yhour);
    lastxs = xsecond;
    lastys = ysecond;
    lastxm = xminute;
    lastym = yminute;
    lastxh = xhour;
    lastyh = yhour;
}

From source file:Gui.Graficos.java

private void init(String titulo, String tituloX, String tituloY) {

    panel = new JPanel();
    panel.setBackground(Color.WHITE);

    getContentPane().add(panel);/*from w ww.  j a va  2s .  c o m*/

    // Creando el Grafico

    JFreeChart chart = ChartFactory.createBarChart3D(titulo, tituloX, tituloY, dataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(new Color(225, 255, 228));
    chart.getTitle().setPaint(Color.black);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Mostrar Grafico

    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);

    // panel.setLayout(new VerticalLayout());

    panel.add(btAceptar);

    //panel.
    panel.setLayout(null);

    chartPanel.setBounds(100, 10, 1100, 600);
    btAceptar.setBounds(1065, 620, 130, 30);

}

From source file:de.berlios.statcvs.xml.chart.AbstractTimeSeriesChart.java

/**
 * @param filename//from   w w w  .ja  va  2s .  co  m
 * @param title
 */
public AbstractTimeSeriesChart(ReportSettings settings, String filename, String title, String rangeLabel) {
    super(settings, filename, title);

    tsc = new TimeSeriesCollection();

    setChart(ChartFactory.createTimeSeriesChart(settings.getProjectName(), I18n.tr("Date"), rangeLabel, tsc,
            true, true, false));

    //Paint[] colors = new Paint[1];
    //colors[0] = Color.blue;
    //getChart().getPlot().setSeriesPaint(colors);

    // setup axis
    XYPlot plot = getChart().getXYPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setVerticalTickLabels(true);
    plot.setRenderer(new XYStepRenderer());

    // the 4th color is yellow which has almost no contrast to the white 
    // background color, therefore we use a different color
    plot.getRenderer().setSeriesPaint(0, Color.red);
    plot.getRenderer().setSeriesPaint(1, Color.blue);
    plot.getRenderer().setSeriesPaint(2, Color.green);
    plot.getRenderer().setSeriesPaint(3, Color.magenta);
    plot.getRenderer().setSeriesPaint(4, Color.orange);
    plot.getRenderer().setSeriesPaint(5, Color.cyan);
    plot.getRenderer().setSeriesPaint(6, Color.pink);
}

From source file:net.sf.dynamicreports.test.jasper.chart.SpiderChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    FieldBuilder<String> column1 = field("field1", String.class);
    TextColumnBuilder<Integer> column2 = col.column("Column2", "field2", Integer.class);

    rb.summary(cmp.horizontalList(//from w w  w .  j  av a2  s.c  o  m
            cht.spiderChart().setCategory(column1).series(cht.serie(column2)).setMaxValue(10d)
                    .setRotation(SpiderRotation.ANTICLOCKWISE).setTableOrder(TableOrder.BY_COLUMN)
                    .setWebFilled(false).setStartAngle(20d).setHeadPercent(30d).setInteriorGap(0.15d)
                    .setAxisLineColor(Color.RED).setAxisLineWidth(2f).setLabelColor(Color.BLUE).setLabelGap(2d)
                    .setLabelFont(stl.font().bold()),
            cht.spiderChart().setCategory(column1).series(cht.serie(column2)).setTitle("title")
                    .setSubtitle("subtitle")));
}

From source file:net.sf.profiler4j.console.AllocDiffPanel.java

public AllocDiffPanel(int maxAgeMillis) {
    super(new BorderLayout());

    totalSeries = new TimeSeries("Allocs/Sec", Millisecond.class);
    totalSeries.setMaximumItemAge(maxAgeMillis);

    TimeSeriesCollection seriesCollection = new TimeSeriesCollection();
    seriesCollection.addSeries(totalSeries);

    NumberAxis numberAxis = new NumberAxis("Allocs/Sec");
    numberAxis.setLabelFont(new Font("SansSerif", 0, 14));
    numberAxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    DateAxis dateAxis = new DateAxis("Time");
    dateAxis.setTickLabelFont(new Font("SansSerif", 0, 12));
    dateAxis.setLabelFont(new Font("SansSerif", 0, 14));
    dateAxis.setAutoRange(true);/*ww  w. j  av a  2  s.c  o  m*/
    dateAxis.setLowerMargin(0);
    dateAxis.setUpperMargin(0);
    dateAxis.setTickLabelsVisible(true);
    dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));

    XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
    lineRenderer.setSeriesPaint(0, Color.RED);
    lineRenderer.setSeriesPaint(1, Color.GREEN.darker());
    lineRenderer.setStroke(new BasicStroke(2F, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));

    XYPlot xyplot = new XYPlot(seriesCollection, dateAxis, numberAxis, lineRenderer);
    xyplot.setBackgroundPaint(Color.WHITE);
    xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));

    JFreeChart chart = new JFreeChart("Object Allocactions in Remote JVM",
            new Font("SansSerif", Font.PLAIN, 18), xyplot, true);
    chart.setBackgroundPaint(Color.white);

    ChartPanel panel = new ChartPanel(chart);
    panel.setBorder(createCompoundBorder(createEmptyBorder(8, 8, 8, 8), createLineBorder(Color.LIGHT_GRAY)));
    add(panel);
    setBorder(createEmptyBorder(8, 8, 8, 8));
}

From source file:classes.SharedClass.java

public void getStatistics() {
    result = db.select("member", new String[] { " count(id) id" }, new String[] { "id" },
            new String[] { "99999" }, "!=", "and");
    try {// www  .j av  a 2  s  .com
        if (result.next()) {
            memberId = result.getInt("id");
        }
    } catch (SQLException ex) {
        Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex);
        ex.printStackTrace();
    }

    //book
    result = db.select("book", new String[] { "count(id)" }, new String[] { "id" }, new String[] { "99999" },
            "!=", "and");
    try {
        if (result.next()) {
            bookId = result.getInt(1);
        }
    } catch (SQLException ex) {
        Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex);
    }

    //operations
    result = db.select("operations", new String[] { "count(id)" }, new String[] { "type" },
            new String[] { "borrowed" }, "=", "and");
    try {
        if (result.next()) {
            operationsId = result.getInt(1);
        }
    } catch (SQLException ex) {
        Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex);
    }
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
    dataSet.setValue(memberId, "Percent", "Members");
    dataSet.setValue(bookId, "Percent", "Books");
    dataSet.setValue(operationsId, "Percent", "Borrowe books");
    JFreeChart chart = ChartFactory.createBarChart3D("Statistics", "Fields", "Percent", dataSet,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.yellow);
    chart.getTitle().setPaint(Color.red);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.blue);
    ChartFrame frame = new ChartFrame("Statistics", chart);
    frame.setLocationRelativeTo(null);
    frame.setSize(500, 550);
    frame.setVisible(true);
}

From source file:DashboardInterface.TensionSpeedDial.java

public TensionSpeedDial(JPanel parentIn) {
    super(new BorderLayout());
    parent = parentIn;// w w  w.j  av  a2 s.  c o  m
    dataset1 = new DefaultValueDataset(0D);
    dataset2 = new DefaultValueDataset(0D);
    pipe = MessagePipeline.getInstance();
    pipe.attach(this);
    DialPlot dialplot = new DialPlot();
    dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);
    dialplot.setDataset(0, dataset1);
    dialplot.setDataset(1, dataset2);
    setBackground(Color.WHITE);
    StandardDialFrame standarddialframe = new StandardDialFrame();
    standarddialframe.setBackgroundPaint(Color.lightGray);
    standarddialframe.setForegroundPaint(Color.darkGray);

    dialplot.setDialFrame(standarddialframe);

    DialBackground dialbackground = new DialBackground(Color.LIGHT_GRAY);

    dialbackground.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    dialplot.setBackground(dialbackground);

    DialTextAnnotation dialtextannotation = new DialTextAnnotation("Tension (lbf)");
    dialtextannotation.setFont(new Font("Dialog", 1, 12));
    dialtextannotation.setPaint(Color.RED);
    dialtextannotation.setRadius(0.47999999999999996D);
    dialplot.addLayer(dialtextannotation);

    DialTextAnnotation dialtextannotation2 = new DialTextAnnotation("Speed (kts)");
    dialtextannotation2.setFont(new Font("Dialog", 1, 12));
    dialtextannotation2.setPaint(Color.BLUE);
    dialtextannotation2.setRadius(0.78999999999999996D);
    dialplot.addLayer(dialtextannotation2);

    /*DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
    dialvalueindicator.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator.setOutlinePaint(Color.BLACK);
    dialvalueindicator.setRadius(0.84999999999999998D);
    dialvalueindicator.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator);
            
    DialValueIndicator dialvalueindicator1 = new DialValueIndicator(1);
    dialvalueindicator1.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator1.setOutlinePaint(Color.BLACK);
    dialvalueindicator1.setRadius(0.60999999999999998D);
    dialvalueindicator1.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator1);*/

    StandardDialScale standarddialscale = new StandardDialScale(0D, 90D, -120D, -300D, 10D, 4);
    standarddialscale.setTickRadius(0.88D);
    standarddialscale.setTickLabelOffset(0.14999999999999999D);
    standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14));
    standarddialscale.setTickLabelPaint(Color.BLUE);
    standarddialscale.setMajorTickPaint(Color.BLUE);
    standarddialscale.setMinorTickPaint(Color.BLUE);
    dialplot.addScale(0, standarddialscale);

    StandardDialScale standarddialscale1 = new StandardDialScale(0.0D, 2500D, -120D, -300D, 500D, 4);
    standarddialscale1.setTickRadius(0.5D);
    standarddialscale1.setTickLabelOffset(0.14999999999999999D);
    standarddialscale1.setTickLabelFont(new Font("Dialog", 0, 10));
    standarddialscale1.setTickLabelPaint(Color.RED);
    standarddialscale1.setMajorTickPaint(Color.RED);
    standarddialscale1.setMinorTickPaint(Color.RED);
    dialplot.addScale(1, standarddialscale1);

    dialplot.mapDatasetToScale(1, 1);

    org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer(
            0);
    pointer.setFillPaint(Color.BLUE);
    dialplot.addPointer(pointer);

    org.jfree.chart.plot.dial.DialPointer.Pointer pin = new org.jfree.chart.plot.dial.DialPointer.Pointer(1);
    pin.setRadius(0.55000000000000004D);
    pin.setFillPaint(Color.RED);
    dialplot.addPointer(pin);

    DialCap dialcap = new DialCap();
    dialcap.setRadius(0.10000000000000001D);
    dialplot.setCap(dialcap);

    Dimension size = parent.getBounds().getSize();
    int width = parent.getWidth();
    int height = parent.getHeight();

    width = 200;

    JFreeChart jfreechart = new JFreeChart(dialplot);
    jfreechart.setBackgroundPaint(Color.WHITE);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(width, width));

    add(chartpanel);
}

From source file:org.rioproject.examples.hospital.ui.PatientStatsPanel.java

public PatientStatsPanel() {
    super(new BorderLayout(8, 8));
    setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8));
    patientLabel = new JLabel(getLabelText(null));
    add(patientLabel, BorderLayout.NORTH);
    pulseTimeSeries.setMaximumItemAge(5 * MINUTE);
    temperatureTimeSeries.setMaximumItemAge(5 * MINUTE);
    TimeSeriesCollection pulseDataSet = new TimeSeriesCollection(pulseTimeSeries);
    TimeSeriesCollection temperatureDataSet = new TimeSeriesCollection(temperatureTimeSeries);
    JFreeChart pulseChart = createTimeSeriesChart(pulseDataSet, Color.RED);
    JFreeChart temperatureChart = createTimeSeriesChart(temperatureDataSet, Color.BLUE);

    JPanel chartPanel = new JPanel(new GridLayout(1, 2));
    chartPanel.add(makeChartPanel(pulseChart));
    chartPanel.add(makeChartPanel(temperatureChart));
    add(chartPanel, BorderLayout.CENTER);
    scheduler = Executors.newSingleThreadScheduledExecutor();
    scheduler.scheduleAtFixedRate(new FeederTask(), 0, 2, TimeUnit.SECONDS);
}

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

/**
 * Default constructor./*from w ww .j av a 2  s .  c o  m*/
 *
 * @param title  the frame title.
 */
public PieChartDemo3(final String title) {

    super(title);

    // create a dataset...
    final DefaultPieDataset data = new DefaultPieDataset();

    // create the chart...
    final JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 3", // chart title
            data, // data
            true, // include legend
            true, false);

    final PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage("No data available");
    plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10));
    plot.setNoDataMessagePaint(Color.red);

    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}