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:gui.MainForm.java

private static JFreeChart create_AMS_DATA_Chart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("AMS??", "", "??", categorydataset,
            PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeCrosshairVisible(true);
    categoryplot.setRangeCrosshairPaint(Color.blue);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
    return jfreechart;
}

From source file:com.rapidminer.gui.plotter.charts.ColorizedLineAndShapeRenderer.java

@Override
public Paint getItemPaint(int series, int item) {
    if ((colorValues == null) || (minColor == maxColor)) {
        return Color.RED;
    } else {//from www. j  a  va2  s.  c om
        double normalized = (colorValues[series] - minColor) / (maxColor - minColor);
        return colorProvider.getPointColor(normalized);
    }
}

From source file:com.sciaps.utils.Util.java

public static int validateOneOrGreater(JTextField txtField) {

    Pattern pattern = Pattern.compile(POSITIVE_INT);
    if (pattern.matcher(txtField.getText()).matches()) {
        int val = getStringToInt(txtField.getText());
        if (val > 0) {
            txtField.setBackground(Color.white);
            return val;
        }/*from ww  w.  jav a2s  . c o  m*/
    }

    txtField.setBackground(Color.red);
    return -1;
}

From source file:org.usfirst.frc.team2084.smartdashboard.extensions.BetterCompass.java

@Override
public void init() {
    // needleType.add("Arrow", 0);
    // needleType.add("Line", 1);
    // needleType.add("Long", 2);
    // needleType.add("Pin", 3);
    // needleType.add("Plum", 4);
    // needleType.add("Pointer", 5);
    // needleType.add("Ship", 6);
    // needleType.add("Wind", 7);
    // needleType.add("Arrow Line", 8);
    // needleType.add("Middle Pin", 9);
    // needleType.setDefault("Arrow Line");

    SwingUtilities.invokeLater(() -> {
        setLayout(new BorderLayout());

        compass = new CompassPlot(getDataset());
        compass.setSeriesNeedle(8);//from   w ww .ja va  2 s  .  c  o  m
        // propertyChanged(needleType);
        compass.setSeriesPaint(0, Color.RED);
        compass.setSeriesOutlinePaint(0, Color.RED);

        JFreeChart chart = new JFreeChart(getFieldName(), JFreeChart.DEFAULT_TITLE_FONT, compass, false);
        chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new Dimension(250, 150));

        propertyChanged(circumference);
        propertyChanged(ringColor);

        add(chartPanel, BorderLayout.CENTER);

        revalidate();
        repaint();
    });
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Bar Chart Demo", "Category", "Value", categorydataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangeGridlinePaint(Color.white);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    barrenderer.setSeriesPaint(0, gradientpaint);
    barrenderer.setSeriesPaint(1, gradientpaint1);
    barrenderer.setSeriesPaint(2, gradientpaint2);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
    return jfreechart;
}

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

private static JFreeChart createChart(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart("SubCategoryAxis Demo 1", "Category", "Value", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    SubCategoryAxis subCategoryAxis = new SubCategoryAxis(null);
    subCategoryAxis.addSubCategory("S1");
    subCategoryAxis.addSubCategory("S2");
    subCategoryAxis.addSubCategory("S3");
    plot.setDomainAxis(subCategoryAxis);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis();
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);/*w w  w  .  j  av  a2s  .  co  m*/
    GradientPaint gradientpaint0 = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
    GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
    GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gradientpaint0);
    renderer.setSeriesPaint(1, gradientpaint1);
    renderer.setSeriesPaint(2, gradientpaint2);
    return chart;
}

From source file:org.jfree.graphics2d.demo.ImageTest.java

private static void drawRadialGradientPaintTest(Graphics2D g2) {
    RadialGradientPaint rgp = new RadialGradientPaint(50, 50, 40, 30, 30, new float[] { 0f, 0.75f, 1f },
            new Color[] { Color.RED, Color.GREEN, Color.BLUE }, MultipleGradientPaint.CycleMethod.NO_CYCLE);

    g2.setPaint(rgp);// w w  w.  j a v a2s  .  c om
    Ellipse2D circle = new Ellipse2D.Double(10, 10, 80, 80);
    g2.fill(circle);
}

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

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.meterChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setShape(MeterShape.CIRCLE)
            .setMeterAngle(270).setUnits("units").setTickInterval(3d).setMeterBackgroundColor(Color.LIGHT_GRAY)
            .setNeedleColor(Color.CYAN).setTickColor(Color.MAGENTA).setTickLabelFont(stl.fontCourierNew())
            .intervals(// www . ja v a  2  s. c  o  m
                    cht.meterInterval().setLabel("red").setAlpha(0.8).setBackgroundColor(Color.RED)
                            .setDataRangeLowExpression(25).setDataRangeHighExpression(30),
                    cht.meterInterval().setLabel("yellow").setAlpha(0.5).setBackgroundColor(Color.YELLOW)
                            .setDataRangeLowExpression(20).setDataRangeHighExpression(25)),
            cht.meterChart().setValue(5).setShape(MeterShape.DIAL));
}

From source file:utils.ChartUtils.java

/**
 * Update IR bar chart//from w w w . j  a  va  2 s . co m
 * 
 * @param labelsByFrequency Labels ordered by frequency
 * @param IR Imbalance Ratio values
 * @param cp CategoryPlot
 */
public static void updateIRBarChart(ImbalancedFeature[] labelsByFrequency, double[] IR, CategoryPlot cp) {
    DefaultCategoryDataset myData = new DefaultCategoryDataset();

    double prob = 0;

    labelsByFrequency = MetricUtils.sortByFrequency(labelsByFrequency);

    double sum = 0.0;
    for (int i = labelsByFrequency.length - 1; i >= 0; i--) {
        prob = IR[i];
        sum += prob;
        myData.setValue(prob, labelsByFrequency[i].getName(), " ");
    }

    cp.setDataset(myData);

    // add mean mark
    sum = sum / labelsByFrequency.length;
    Marker meanMark = new ValueMarker(sum);
    meanMark.setPaint(Color.red);
    meanMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
    meanMark.setLabel("                        Mean: " + MetricUtils.truncateValue(sum, 3));
    cp.addRangeMarker(meanMark);

    //Add Imbalance limit mark
    Marker limitMark = new ValueMarker(1.5);
    limitMark.setPaint(Color.black);
    limitMark.setLabelFont(new Font("SansSerif", Font.BOLD, 12));

    if ((sum < 1.3) || (sum > 1.7)) {
        limitMark.setLabel("                                                Imbalance limit (IR=1.5)");
    }
    cp.addRangeMarker(limitMark);
}

From source file:trendgraph.XYLineChart_AWT.java

public XYLineChart_AWT(int yearStart, int yearEnd, String[] creditUnionName, String columnName)
        throws SQLException {
    super("Graph");
    super.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.yearStart = yearStart;
    this.yearEnd = yearEnd;
    this.creditUnionName = creditUnionName;
    this.columnName = columnName;
    saveGraphButton = new JButton("Save Graph");
    saveGraphButton.setBorderPainted(false);
    saveGraphButton.setFocusPainted(false);

    JFreeChart xylineChart = ChartFactory.createXYLineChart("CU Report", "Year (YYYY)", //X-axis
            columnName, //Y-axis (replace with columnName
            createDataset(), PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1000, 800)); //(x, y)
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

    renderer.setSeriesPaint(0, Color.RED); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(0, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(1, Color.BLUE); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(1, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(2, Color.GREEN); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(2, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(3, Color.yellow); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(3, new BasicStroke(3.0f)); //Font size

    plot.setRenderer(renderer);/*from   w ww .j  a  v a 2 s  .  c  o m*/
    chartPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    chartPanel.add(saveGraphButton);
    setContentPane(chartPanel);
    pack();
    RefineryUtilities.centerFrameOnScreen(this);
    setVisible(true);

    saveGraphButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Rectangle rect = chartPanel.getBounds();
            FileChooser chooser = new FileChooser();

            //get chosen path and save the variable
            String path = chooser.getPath();
            path = path.replace("\\", "/");

            String format = "png";
            String fileName = path + "." + format;
            BufferedImage captureImage = new BufferedImage(rect.width, rect.height,
                    BufferedImage.TYPE_INT_ARGB);
            chartPanel.paint(captureImage.getGraphics());

            File file = new File(fileName);

            try {
                ImageIO.write(captureImage, format, file);

                //write data to file
            } catch (IOException ex) {
                Logger.getLogger(XYLineChart_AWT.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}