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:playground.anhorni.surprice.analysis.SupriceBoxPlot.java

public JFreeChart createChart() {
    String title = chartTitle;/*w w w. j  a v a 2 s . c  om*/

    final CategoryAxis xAxis = new CategoryAxis(this.xAxisName);
    xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    final NumberAxis yAxis = new NumberAxis(this.yAxisName);
    yAxis.setAutoRangeIncludesZero(true);

    if (Math.abs(yrangeLower - yrangeUpper) > Double.MIN_VALUE) {
        yAxis.setRange(yrangeLower, yrangeUpper);
    }

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}

From source file:pwm.visualizer.MDPPolicyPanel.java

private JFreeChart createChart() {
    NumberAxis nutritionAxis = new NumberAxis("Calories/Day");
    nutritionAxis.setLowerBound(0);//from w w w .  j a  va2  s.c o  m
    nutritionAxis.setUpperBound(5000);
    nutritionAxis.setAutoRange(false);
    //      
    CategoryPlot categoryplot = new CategoryPlot(nutritionDataSet, new CategoryAxis("Weight(KG)"),
            nutritionAxis, new BarRenderer());
    CategoryAxis xaxis = categoryplot.getDomainAxis();
    xaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);

    LegendItemCollection legend = new LegendItemCollection();
    LegendItem nutritionLegend = new LegendItem("Calories/Day");
    LegendItem exerciseLegend = new LegendItem("Physical Activity Level");
    nutritionLegend.setFillPaint(Color.BLUE);
    exerciseLegend.setFillPaint(Color.RED);

    legend.add(nutritionLegend);
    legend.add(exerciseLegend);

    categoryplot.setFixedLegendItems(legend);
    JFreeChart jfreechart = new JFreeChart("Policy Visualizer", categoryplot);
    categoryplot.setDataset(1, exerciseDataSet);
    categoryplot.mapDatasetToRangeAxis(1, 1);

    NumberAxis exerciseAxis = new NumberAxis("Physical Activity Level");
    exerciseAxis.setLowerBound(0);
    exerciseAxis.setUpperBound(3.0);
    exerciseAxis.setAutoRange(false);

    categoryplot.setRangeAxis(1, exerciseAxis);
    BarRenderer barrenderer1 = new BarRenderer();
    categoryplot.setRenderer(1, barrenderer1);

    //        BarRenderer stackedbarrenderer = (BarRenderer)categoryplot.getRenderer();
    //        stackedbarrenderer.setDrawBarOutline(true);
    //        stackedbarrenderer.setBaseItemLabelsVisible(false);
    //        stackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());

    ChartUtilities.applyCurrentTheme(jfreechart);

    return jfreechart;

}

From source file:com.charts.FiveYearChart.java

public FiveYearChart(YStockQuote currentStock) throws ParseException {

    DateAxis domainAxis = new DateAxis("Date");
    NumberAxis rangeAxis = new NumberAxis("Price");
    CandlestickRenderer renderer = new CandlestickRenderer();
    XYDataset dataset = getDataSet(currentStock);

    XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);

    //Do some setting up, see the API Doc
    renderer.setSeriesPaint(0, Color.BLACK);

    renderer.setDrawVolume(false);/*from  w  ww .  j av  a2  s.  c o  m*/
    rangeAxis.setAutoRangeIncludesZero(false);

    domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy"));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    //Now create the chart and chart panel
    JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false);
    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(900, 400));

    XYPlot plot = (XYPlot) chart.getPlot();
    LegendTitle legend = new LegendTitle(plot);
    chart.addLegend(legend);
    chart.getLegend().setVisible(true);
    chart.getLegend().setPosition(RectangleEdge.BOTTOM);
    ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
    DateAxis xAxis = (DateAxis) plot.getDomainAxis();

    xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y"));
    xAxis.setAutoTickUnitSelection(true);
    xAxis.setAutoRange(true);
    renderer.setAutoWidthFactor(0.5);
    renderer.setUpPaint(Color.green);
    renderer.setDownPaint(new Color(0xc0, 0x00, 0x00));
    renderer.setSeriesPaint(0, Color.black);
    StandardXYItemRenderer renderer1 = new StandardXYItemRenderer();
    renderer1.setSeriesPaint(0, Color.BLUE);
    TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0);
    Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue();
    currMA30 = Math.round(currMA30 * 100.0) / 100.0;
    movingAverage30.setKey("MA(30): " + currMA30);
    TimeSeriesCollection collection = new TimeSeriesCollection();
    collection.addSeries(movingAverage30);
    plot.setDataset(1, collection);
    plot.setRenderer(1, renderer1);

    chartPanel.revalidate();
    chartPanel.repaint();
    chartPanel.revalidate();
    chartPanel.repaint();
}

From source file:com.busimu.core.dao.impl.UserMngDaoPolicyJpaImpl.java

private void initExampleData() throws Exception {
    EntityManager em = emf.createEntityManager();
    try {//www . ja v a 2s  .  c om
        EntityTransaction tx = em.getTransaction();
        tx.begin();
        User player1 = new User("student@busimu.com", "ssssss", "s", User.Type.STUDENT);
        player1.setStatus(User.Status.ACTIVE);
        User player2 = new User("zhangsan@busimu.com", "123456", "", User.Type.STUDENT);
        player2.setStatus(User.Status.ACTIVE);
        User player3 = new User("lisi@busimu.com", "123456", "?", User.Type.STUDENT);
        player3.setStatus(User.Status.ACTIVE);
        User teacher = new User("teacher@busimu.com", "tttttt", "t", User.Type.TEACHER);
        teacher.setStatus(User.Status.ACTIVE);
        em.persist(player1);
        em.persist(player2);
        em.persist(player3);
        em.persist(teacher);

        Campaign campaign = teacher.createCampagin("", Campaign.Type.COURSE);
        SimMarket south = campaign.addMarket("??");
        SimMarket central = campaign.addMarket("?");
        SimMarket north = campaign.addMarket("?");
        SimMarket east = campaign.addMarket("?");
        SimMarket west = campaign.addMarket("");
        SimCorporation ibm = south.addCorporation("IBM", new Color(128, 128, 255));
        SimCorporation ericsson = south.addCorporation("Ericsson", Color.BLUE);
        SimCorporation oracle = south.addCorporation("Oracle", Color.RED);
        for (int i = 0; i < 8; i++) {
            campaign.addRound();
        }

        player2.addCampaign(campaign);
        player3.addCampaign(campaign);
        em.persist(campaign);

        Team t1 = new Team("anoym1");
        Team t2 = new Team("anoym2");
        Team t3 = new Team("anoym3");
        t1.addCorporation(ibm);
        t2.addCorporation(ericsson);
        t3.addCorporation(oracle);
        em.persist(t1);
        em.persist(t2);
        em.persist(t3);

        Campaign runningCampaign = teacher.createCampagin("", Campaign.Type.COURSE);
        SimMarket m1 = runningCampaign.addMarket("");
        SimMarket m2 = runningCampaign.addMarket("");
        SimMarket m3 = runningCampaign.addMarket("");
        SimCorporation corp1 = m1.addCorporation("", Color.ORANGE);
        for (int i = 0; i < 3; i++) {
            runningCampaign.addRound();
        }
        player1.addCampaign(runningCampaign);
        player2.addCampaign(runningCampaign);
        player3.addCampaign(runningCampaign);
        runningCampaign.setStatus(Campaign.Status.ONGOING);

        Team t11 = new Team("anoym11");
        t11.addCorporation(corp1);
        t11.addUser(player1);
        t11.addUser(player2);
        t11.addUser(player3);
        em.persist(t11);

        tx.commit();
    } finally {
        em.close();
    }
}

From source file:com.charts.OneYearChart.java

public OneYearChart(YStockQuote currentStock) throws ParseException {

    DateAxis domainAxis = new DateAxis("Date");
    NumberAxis rangeAxis = new NumberAxis("Price");
    CandlestickRenderer renderer = new CandlestickRenderer();
    XYDataset dataset = getDataSet(currentStock);

    XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer);

    //Do some setting up, see the API Doc
    renderer.setSeriesPaint(0, Color.BLACK);

    renderer.setDrawVolume(false);//ww  w  .  ja  v  a  2  s.c o  m
    rangeAxis.setAutoRangeIncludesZero(false);

    domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy"));
    domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

    //Now create the chart and chart panel
    JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false);
    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(900, 400));

    XYPlot plot = (XYPlot) chart.getPlot();
    LegendTitle legend = new LegendTitle(plot);
    chart.addLegend(legend);
    chart.getLegend().setVisible(true);
    chart.getLegend().setPosition(RectangleEdge.BOTTOM);

    ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
    DateAxis xAxis = (DateAxis) plot.getDomainAxis();

    xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y"));
    xAxis.setAutoTickUnitSelection(true);
    xAxis.setAutoRange(true);
    renderer.setAutoWidthFactor(0.5);
    renderer.setUpPaint(Color.green);
    renderer.setDownPaint(new Color(0xc0, 0x00, 0x00));
    renderer.setSeriesPaint(0, Color.black);
    StandardXYItemRenderer renderer1 = new StandardXYItemRenderer();
    renderer1.setSeriesPaint(0, Color.BLUE);
    TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0);
    Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue();
    currMA30 = Math.round(currMA30 * 100.0) / 100.0;
    movingAverage30.setKey("MA(30): " + currMA30);
    TimeSeriesCollection collection = new TimeSeriesCollection();
    collection.addSeries(movingAverage30);
    plot.setDataset(1, collection);
    plot.setRenderer(1, renderer1);

    chartPanel.revalidate();
    chartPanel.repaint();
    chartPanel.revalidate();
    chartPanel.repaint();
}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java

public static Color getColor(String color) {
    // HTML colors (#FFFFFF format)
    if (color.startsWith("#")) {
        return new Color(Integer.parseInt(color.substring(1), 16));
    } else {//from w  ww  . j  a  v  a  2s  .  com
        // Colors by name
        if (color.equalsIgnoreCase("black"))
            return Color.black;
        if (color.equalsIgnoreCase("gray"))
            return Color.gray;
        if (color.equalsIgnoreCase("yellow"))
            return Color.yellow;
        if (color.equalsIgnoreCase("green"))
            return Color.green;
        if (color.equalsIgnoreCase("blue"))
            return Color.blue;
        if (color.equalsIgnoreCase("red"))
            return Color.red;
        if (color.equalsIgnoreCase("orange"))
            return Color.orange;
        if (color.equalsIgnoreCase("cyan"))
            return Color.cyan;
        if (color.equalsIgnoreCase("magenta"))
            return Color.magenta;
        if (color.equalsIgnoreCase("darkgray"))
            return Color.darkGray;
        if (color.equalsIgnoreCase("lightgray"))
            return Color.lightGray;
        if (color.equalsIgnoreCase("pink"))
            return Color.pink;
        if (color.equalsIgnoreCase("white"))
            return Color.white;

        throw new RuntimeException("Unsupported chart color:" + color);
    }
}

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

/**
 * Displays a meter chart.//from w w w  .ja  v a  2 s . com
 *
 * @param value  the value.
 * @param shape  the dial shape.
 */
void displayMeterChart(final double value, final DialShape shape) {

    final DefaultValueDataset data = new DefaultValueDataset(75.0);
    final MeterPlot plot = new MeterPlot(data);
    plot.setUnits("Degrees");
    plot.setRange(new Range(20.0, 140.0));
    //        plot.setNormalRange(new Range(70.0, 100.0));
    //      plot.setWarningRange(new Range(100.0, 120.0));
    //    plot.setCriticalRange(new Range(120.0, 140.0));

    plot.setDialShape(shape);
    plot.setNeedlePaint(Color.white);
    plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 9));

    //  plot.setInsets(new Insets(5, 5, 5, 5));
    final JFreeChart chart = new JFreeChart("Meter Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    //        final MeterLegend legend = new MeterLegend("Sample Meter");
    //      chart.setLegend(legend);

    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.blue));

    final JFrame chartFrame = new ChartFrame("Meter Chart", chart);
    chartFrame.addWindowListener(new WindowAdapter() {
        /**
         * Invoked when a window is in the process of being closed.
         * The close operation can be overridden at this point.
         */
        public void windowClosing(final WindowEvent e) {
            System.exit(0);
        }
    });
    chartFrame.pack();
    RefineryUtilities.positionFrameRandomly(chartFrame);
    chartFrame.setSize(250, 250);
    chartFrame.setVisible(true);

}

From source file:Main.java

@Override
public void paintDeterminate(Graphics g, JComponent c) {
    if (!(g instanceof Graphics2D)) {
        return;/*from w w w. jav a2  s .c om*/
    }
    Insets b = progressBar.getInsets(); // area for border
    int barRectWidth = progressBar.getWidth() - (b.right + b.left);
    int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);
    if (barRectWidth <= 0 || barRectHeight <= 0) {
        return;
    }
    int cellLength = getCellLength();
    int cellSpacing = getCellSpacing();

    int amountFull = getAmountFull(b, barRectWidth, barRectHeight);

    if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {

        float x = amountFull / (float) barRectWidth;
        g.setColor(Color.BLUE);
        g.fillRect(b.left, b.top, amountFull, barRectHeight);

    } else { // VERTICAL

    }
    if (progressBar.isStringPainted()) {
        paintString(g, b.left, b.top, barRectWidth, barRectHeight, amountFull, b);
    }
}

From source file:io.datalayer.jung.SdpGraphMLDemo.java

/**
 * create an instance of a simple graph with controls to demo the zoom
 * features./*from   w w w.ja  v a 2  s  .com*/
 * 
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
public SdpGraphMLDemo(String filename) throws ParserConfigurationException, SAXException, IOException {

    Factory<Number> vertexFactory = new Factory<Number>() {

        int n = 0;

        public Number create() {

            return n++;
        }
    };
    Factory<Number> edgeFactory = new Factory<Number>() {

        int n = 0;

        public Number create() {

            return n++;
        }
    };

    GraphMLReader<DirectedGraph<Number, Number>, Number, Number> gmlr = new GraphMLReader<DirectedGraph<Number, Number>, Number, Number>(
            vertexFactory, edgeFactory);
    final DirectedGraph<Number, Number> graph = new DirectedSparseMultigraph<Number, Number>();
    gmlr.load(filename, graph);

    // create a simple graph for the demo
    vv = new VisualizationViewer<Number, Number>(new FRLayout<Number, Number>(graph));

    vv.addGraphMouseListener(new TestGraphMouseListener<Number>());
    vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<Number, Number>(Color.white, Color.red,
            Color.white, Color.blue, vv.getPickedVertexState(), false));

    // add my listeners for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Number>());
    vv.setEdgeToolTipTransformer(new Transformer<Number, String>() {

        public String transform(Number edge) {

            return "E" + graph.getEndpoints(edge).toString();
        }
    });

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
    vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

    // create a frome to hold the graph
    final JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final AbstractModalGraphMouse graphMouse = new DefaultModalGraphMouse<Number, Number>();
    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    panel.setCorner(menubar);

    vv.addKeyListener(graphMouse.getModeKeyListener());
    vv.setToolTipText("<html><center>Type 'p' for Pick mode<p>Type 't' for Transform mode");

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    content.add(controls, BorderLayout.SOUTH);

    frame.pack();
    frame.setVisible(true);
}

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

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<Date> column2;
    TextColumnBuilder<Double> column3;
    TextColumnBuilder<Double> column4;
    TextColumnBuilder<Double> column5;
    TextColumnBuilder<Double> column6;
    TextColumnBuilder<Double> column7;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Date.class),
            column3 = col.column("Column3", "field3", Double.class),
            column4 = col.column("Column4", "field4", Double.class),
            column5 = col.column("Column5", "field5", Double.class),
            column6 = col.column("Column6", "field6", Double.class),
            column7 = col.column("Column7", "field7", Double.class))
            .summary(//from   w  ww .  j av  a2 s.c om
                    cht.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7).setShowVolume(false),
                    cht.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .setTimeAxisFormat(cht.axisFormat().setLabel("time").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)
                                    .setVerticalTickLabels(true)),
                    cht.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .setValueAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15).setVerticalTickLabels(true)));
}