Example usage for java.awt Color blue

List of usage examples for java.awt Color blue

Introduction

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

Prototype

Color blue

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

Click Source Link

Document

The color blue.

Usage

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date",
            "Price Per Unit", xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
        xylineandshaperenderer.setBaseItemLabelsVisible(true);
    }/*from   w ww  .j av  a 2  s. c  o m*/
    PeriodAxis periodaxis = new PeriodAxis("Date");
    periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class);
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3];
    aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"));
    aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class,
            new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10),
            Color.blue, false, new BasicStroke(0.0F), Color.lightGray);
    aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class,
            new SimpleDateFormat("yyyy"));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);
    return jfreechart;
}

From source file:AttributesApp.java

public AttributesApp() {
    setBackground(Color.lightGray);
    setSize(500, 200);//www  .j  a va2 s.  c om

    attribString = new AttributedString(text);

    GeneralPath star = new GeneralPath();
    star.moveTo(0, 0);
    star.lineTo(10, 30);
    star.lineTo(-10, 10);
    star.lineTo(10, 10);
    star.lineTo(-10, 30);
    star.closePath();
    GraphicAttribute starShapeAttr = new ShapeGraphicAttribute(star, GraphicAttribute.TOP_ALIGNMENT, false);
    attribString.addAttribute(TextAttribute.CHAR_REPLACEMENT, starShapeAttr, 0, 1);
    attribString.addAttribute(TextAttribute.FOREGROUND, new Color(255, 255, 0), 0, 1);

    int index = text.indexOf("Java Source");
    attribString.addAttribute(TextAttribute.FOREGROUND, Color.blue, index, index + 7);
    Font font = new Font("sanserif", Font.ITALIC, 40);
    attribString.addAttribute(TextAttribute.FONT, font, index, index + 7);

    loadImage();
    BufferedImage bimage = new BufferedImage(image.getWidth(this), image.getHeight(this),
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D big = bimage.createGraphics();
    big.drawImage(image, null, this);
    GraphicAttribute javaImageAttr = new ImageGraphicAttribute(bimage, GraphicAttribute.TOP_ALIGNMENT, 0, 0);

    index = text.indexOf("Java");
    attribString.addAttribute(TextAttribute.CHAR_REPLACEMENT, javaImageAttr, index - 1, index);

    font = new Font("serif", Font.BOLD, 60);
    attribString.addAttribute(TextAttribute.FONT, font, index, index + 4);
    attribString.addAttribute(TextAttribute.FOREGROUND, new Color(243, 63, 163), index, index + 4); // Start and end indexes.

    index = text.indexOf("source");
    attribString.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, index, index + 2);

    index = text.indexOf("and support");
    font = new Font("sanserif", Font.ITALIC, 40);
    attribString.addAttribute(TextAttribute.FONT, font, index, index + 10);

    attribString.addAttribute(TextAttribute.FOREGROUND, Color.white, index, index + 2); // Start and end indexes.
    attribString.addAttribute(TextAttribute.FOREGROUND, Color.blue, index + 3, index + 10); // Start and end indexes.
}

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

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

    rb.setLocale(Locale.ENGLISH).summary(cht.thermometerChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setValueLocation(ValueLocation.BULB)
            .setMercuryColor(Color.LIGHT_GRAY).setLowDataRangeLowExpression(8).setLowDataRangeHighExpression(10)
            .setMediumDataRangeLowExpression(18).setMediumDataRangeHighExpression(20)
            .setHighDataRangeLowExpression(28).setHighDataRangeHighExpression(30),
            cht.thermometerChart().setValue(field("field1", Integer.class)));
}

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(//from  w w w. j  a  va2  s. com
                    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:de.bund.bfr.jung.JungUtils.java

public static <V, E> Transformer<V, Paint> newNodeFillTransformer(RenderContext<V, E> renderContext,
        Map<V, Paint> nodeColors) {
    return node -> {
        Paint color = nodeColors != null && nodeColors.containsKey(node) ? nodeColors.get(node) : Color.WHITE;

        return renderContext.getPickedVertexState().isPicked(node) ? mixWith(color, Color.BLUE) : color;
    };//  ww  w  .  j av  a 2s.  c om
}

From source file:Charts2D.java

public Charts2D() {
    super("2D Charts");
    setSize(720, 280);/*ww w . j  av  a 2 s .co m*/
    getContentPane().setLayout(new GridLayout(1, 3, 10, 0));
    getContentPane().setBackground(Color.white);

    int[] xData = new int[8];
    int[] yData = new int[8];
    for (int i = 0; i < xData.length; i++) {
        xData[i] = i;
        yData[i] = (int) (Math.random() * 100);
        if (i > 0)
            yData[i] = (yData[i - 1] + yData[i]) / 2;
    }

    JChart2D chart = new JChart2D(JChart2D.LineChart, xData.length, xData, yData, "Line Chart");
    chart.setStroke(new BasicStroke(5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
    chart.setLineColor(new Color(0, 28, 28));
    getContentPane().add(chart);

    chart = new JChart2D(JChart2D.ColumnChart, xData.length, xData, yData, "Column Chart");
    GradientPaint gp = new GradientPaint(0, 100, Color.white, 0, 300, Color.blue, true);
    chart.setGradient(gp);
    chart.setEffectIndex(JChart2D.Gradientffect);
    chart.setDrawShadow(true);
    getContentPane().add(chart);

    chart = new JChart2D(JChart2D.PieChart, xData.length, xData, yData, "Pie Chart");
    ImageIcon icon = new ImageIcon("largeJava2slogo.GIF");
    chart.setForegroundImage(icon.getImage());
    chart.setEffectIndex(JChart2D.ImageEffect);
    chart.setDrawShadow(true);
    getContentPane().add(chart);

    WindowListener wndCloser = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(wndCloser);

    setVisible(true);
}

From source file:BorderTest.java

public BorderFrame() {
    setTitle("BorderTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    demoPanel = new JPanel();
    buttonPanel = new JPanel();
    group = new ButtonGroup();

    addRadioButton("Lowered bevel", BorderFactory.createLoweredBevelBorder());
    addRadioButton("Raised bevel", BorderFactory.createRaisedBevelBorder());
    addRadioButton("Etched", BorderFactory.createEtchedBorder());
    addRadioButton("Line", BorderFactory.createLineBorder(Color.BLUE));
    addRadioButton("Matte", BorderFactory.createMatteBorder(10, 10, 10, 10, Color.BLUE));
    addRadioButton("Empty", BorderFactory.createEmptyBorder());

    Border etched = BorderFactory.createEtchedBorder();
    Border titled = BorderFactory.createTitledBorder(etched, "Border types");
    buttonPanel.setBorder(titled);//from  ww w .ja  v  a 2  s .c o m

    setLayout(new GridLayout(2, 1));
    add(buttonPanel);
    add(demoPanel);
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart("Open Source Projects By Licence", "Licence",
            "Project Count", categorydataset, PlotOrientation.HORIZONTAL, false, 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);
    categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.4F);
    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));
    barrenderer.setSeriesPaint(0, gradientpaint);
    return jfreechart;
}

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

private static JFreeChart createChart(String s, CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart(s, "Category", "Value", categorydataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    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);
    return jfreechart;
}

From source file:IHM.NewClass.java

/**
 *
 * @param title/*from   w  ww . j av  a2  s  .c o  m*/
 */
public NewClass(String title /*,*JInternalFrame jp*/) {
    super(title);
    // jp = new JInternalFrame("courbes");

    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(500, 300));
    setContentPane(panel);
    //  jp.add(panel, BorderLayout.EAST);
    //  jp.setVisible(true);
    panel.setVisible(true);
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    // sets thickness for series (using strokes)
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setRenderer(renderer);
    plot.setOutlinePaint(Color.BLUE);
    plot.setOutlineStroke(new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);

}