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:edu.uci.ics.jung.samples.GraphFromGraphMLDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoom features.//from ww  w . j a  va2  s .  co  m
 * @throws SAXException 
 * @throws ParserConfigurationException 
 * @throws IOException 
 * 
 */
public GraphFromGraphMLDemo(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<Graph<Number, Number>, Number, Number> gmlr = new GraphMLReader<Graph<Number, Number>, Number, Number>(
            vertexFactory, edgeFactory);
    //final DirectedGraph<Number,Number> graph = new DirectedSparseMultigraph<Number,Number>();
    final Graph<Number, Number> graph = new SparseGraph<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.HighLowChartTest.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 ww w  .  jav  a 2s  .  co m*/
                    cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7).setShowOpenTicks(true)
                            .setShowCloseTicks(true),
                    cht.highLowChart().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.highLowChart().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)));
}

From source file:spec.reporter.Utils.java

public static void createBmResultGraph(BenchmarkRecord record) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    String iterName = "";
    double max = 0;
    double min = Long.MAX_VALUE;
    for (int i = 0; i < record.iterRecords.size(); i++) {
        BenchmarkRecord.IterationRecord iterRecord = (BenchmarkRecord.IterationRecord) record.iterRecords
                .get(i);// w w  w  .  j  a v a2 s.  com
        String shortName = iterRecord.iterName.replaceFirst("ation", "");
        if (iterRecord.score > max) {
            max = iterRecord.score;
            iterName = shortName;
        }

        if (iterRecord.score < min) {
            min = iterRecord.score;
        }

        dataset.addValue(iterRecord.score, " ", shortName);
    }

    JFreeChart chart = ChartFactory.createLineChart("  ", "iterations", Constants.WORKLOAD_METRIC, dataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(new Color(201, 222, 254));
    plot.setRangeGridlinePaint(Color.WHITE);
    if (record.isValidRun() && min != Long.MAX_VALUE) {
        plot.getRangeAxis().setRange(min - 10, max + 10);
    } else {
        plot.getRangeAxis().setRange(0, max + 10);
    }
    ValueMarker vm = new ValueMarker(record.maxScore);
    vm.setLabel(Utils.df.format(record.maxScore));
    vm.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    vm.setLabelTextAnchor(TextAnchor.HALF_ASCENT_LEFT);

    plot.addRangeMarker(vm);
    CategoryMarker marker = new CategoryMarker(iterName);
    marker.setDrawAsLine(true);
    marker.setPaint(vm.getPaint());
    plot.addDomainMarker(marker);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setFillPaint(Color.WHITE);
    renderer.setSeriesPaint(0, Color.BLUE.darker());

    try {
        ChartUtilities.saveChartAsJPEG(new File(Utils.getFullImageName(record.name + "_results")), chart, 300,
                200);
    } catch (Exception e) {
        System.out.println("Problems...");
    }
}

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

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/* w w  w  .  j av a2 s  .  co m*/

    chartCountTest("summary.chart1", 1);
    JFreeChart chart = getChart("summary.chart1", 0);

    TextTitle title = chart.getTitle();
    Assert.assertEquals("title", "title", title.getText());
    Assert.assertEquals("title color", Color.BLUE, title.getPaint());
    Assert.assertEquals("title font", new Font("Arial", Font.BOLD, 10), title.getFont());
    Assert.assertEquals("title position", RectangleEdge.RIGHT, title.getPosition());

    TextTitle subtitle = (TextTitle) chart.getSubtitle(1);
    Assert.assertEquals("subtitle", "subtitle", subtitle.getText());
    Assert.assertEquals("subtitle color", Color.CYAN, subtitle.getPaint());
    Assert.assertEquals("subtitle font", new Font("Arial", Font.PLAIN, 10), subtitle.getFont());

    LegendTitle legend = (LegendTitle) chart.getSubtitle(0);
    Assert.assertEquals("legend color", Color.BLUE, legend.getItemPaint());
    Assert.assertEquals("legend backgroundcolor", Color.LIGHT_GRAY, legend.getBackgroundPaint());
    Assert.assertEquals("legend font", new Font("Courier New", Font.PLAIN, 10), legend.getItemFont());
    Assert.assertEquals("legend position", RectangleEdge.LEFT, legend.getPosition());

    chartCountTest("summary.chart2", 1);
    chart = getChart("summary.chart2", 0);
    Assert.assertNull("legend", chart.getLegend());
    Assert.assertEquals("plot orientation", PlotOrientation.HORIZONTAL,
            chart.getCategoryPlot().getOrientation());
    Assert.assertEquals("plot series colors", Color.BLUE, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.GREEN, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.RED, chart.getPlot().getDrawingSupplier().getNextPaint());
}

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

private static JFreeChart createChart(OHLCDataset ohlcdataset) {
    JFreeChart jfreechart = ChartFactory.createHighLowChart("OHLC Demo 3", "Time", "Price", ohlcdataset, true);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    HighLowRenderer highlowrenderer = (HighLowRenderer) xyplot.getRenderer();
    highlowrenderer.setBaseStroke(new BasicStroke(2.0F));
    highlowrenderer.setSeriesPaint(0, Color.blue);
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    NumberAxis numberaxis1 = new NumberAxis("Price 2");
    numberaxis1.setAutoRangeIncludesZero(false);
    xyplot.setRangeAxis(1, numberaxis1);
    xyplot.setDataset(1, createDataset2());
    xyplot.setRenderer(1, new CandlestickRenderer(10D));
    xyplot.mapDatasetToRangeAxis(1, 1);// ww  w.j a v a2  s.c  om
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

From source file:sim.app.sugarscape.SugarscapeWithUIHigh.java

public void setupPortrayals() {
    // tell the portrayals what to
    // portray and how to portray them
    agentsPortrayal.setField(((Sugarscape) state).agents_grid);
    AgentPortrayal2D ap = new AgentPortrayal2D(Color.blue);
    agentsPortrayal.setPortrayalForNull(ap);
    agentsPortrayal.setPortrayalForAll(ap); /* does all cover null objects? */
    scapePortrayal.setField(((Sugarscape) state).scape_grid);
    scapePortrayal.setPortrayalForAll(new sim.app.sugarscape.ScapePortrayal2D(Color.yellow));

    pollutionPortrayal.setField(((Sugarscape) state).scape_grid);
    pollutionPortrayal.setPortrayalForAll(new sim.app.sugarscape.PollutionPortrayal2D(Color.yellow));

    ((Sugarscape) state).console = console;
    // reschedule the displayer
    display.reset();// w w w .j a v  a 2s  . com
    // redraw the display
    display.repaint();
}

From source file:support.SystemMonitorGui.java

private XYPlot createChartFrame(XYSeries series) {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    dataSet.addSeries(series);// w  w  w  .j av a2 s. c  o m
    JFreeChart chart = ChartFactory.createXYLineChart("Memory Allocation Rate", "Time (ms)",
            "Allocation Rate (MB/s)", dataSet, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.getRenderer().setSeriesPaint(0, Color.BLUE);

    JFrame frame = new JFrame();
    frame.setBackground(Color.WHITE);
    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    frame.setTitle("Hazelcast Jet Source Builder Sample");
    frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT);
    frame.setLayout(new BorderLayout());
    frame.add(new ChartPanel(chart));
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent windowEvent) {
            hzMap.removeEntryListener(entryListenerId);
        }
    });
    frame.setVisible(true);
    return plot;
}

From source file:org.mili.jmibs.jfree.JFreeChartBarIterationObjectLoadBenchmarkSuiteResultRenderer.java

private JFreeChart createChart(String title, CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, "Benchmark (Iteration/Object Loading)", "Time in ns",
            dataset, PlotOrientation.HORIZONTAL, true, true, false);
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);/*from  w  ww.  jav a  2 s . c o m*/
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    return chart;
}

From source file:view.PrograssCharts.java

/**
 * Creates new form PrograssCharts/* w ww  .j a  v a  2  s .  c  o  m*/
 */
public PrograssCharts(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    try {
        initComponents();
        setSize(1400, 800);
        jPanel1.setVisible(false);
        jPanel2.setVisible(false);

        new Thread(new Runnable() {

            @Override
            public void run() {
                loading1();
                loading2();
                run();

            }
        }).start();

        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        DefaultCategoryDataset dataset1 = new DefaultCategoryDataset();
        dataset.setValue(QuestionLab.cat1, "gfdg", "Collectns");
        dataset.setValue(QuestionLab.cat2, "gfdg", "Data");
        dataset.setValue(QuestionLab.cat3, "gfdg", "Dev");
        dataset.setValue(QuestionLab.cat4, "gfdg", "Excep");
        dataset.setValue(QuestionLab.cat5, "gfdg", "File");
        dataset.setValue(QuestionLab.cat6, "gfdg", "FlowCon");
        dataset.setValue(QuestionLab.cat7, "gfdg", "Format");
        dataset.setValue(QuestionLab.cat8, "gfdg", "GC");
        dataset.setValue(QuestionLab.cat9, "gfdg", "IC");
        dataset.setValue(QuestionLab.cat10, "gfdg", "VarArgs");
        dataset.setValue(QuestionLab.cat11, "gfdg", "Fundamt");
        dataset.setValue(QuestionLab.cat12, "gfdg", "Modif");
        dataset.setValue(QuestionLab.cat13, "gfdg", "OOP");
        dataset.setValue(QuestionLab.cat14, "gfdg", "Vari");
        dataset.setValue(QuestionLab.cat15, "gfdg", "String");
        dataset.setValue(QuestionLab.cat16, "gfdg", "Threads");
        dataset.setValue(QuestionLab.cat17, "gfdg", "WC");
        JFreeChart freeChart = ChartFactory.createBarChart("Exam Prograss by Subjects", "Subject", "Marks",
                dataset, PlotOrientation.VERTICAL, false, true, false);
        //JFreeChart freeChart1 = ChartFactory.createBarChart("Income", " Name", "Incomesss", dataset1, PlotOrientation.VERTICAL, false, true, false);
        TimeSeries pop = new TimeSeries("Population", Day.class);

        //JFreeChart chart=ChartFactory.create
        CategoryPlot plot = freeChart.getCategoryPlot();
        plot.setRangeGridlinePaint(Color.BLUE);
        ChartFrame frame = new ChartFrame("Exam Prograss", freeChart);

        //        frame.setVisible(true);
        //        frame.setSize(550, 450);
        // JPanel jPanel1 = new JPanel();
        jPanel1.setLayout(new java.awt.BorderLayout());

        ChartPanel CP = new ChartPanel(freeChart);
        CP.setPreferredSize(new Dimension(785, 440));
        CP.setMouseWheelEnabled(true);

        jPanel1.add(CP);
        jPanel1.revalidate();

        ArrayList<Exam> setChartValue = ServerConnector.getServerConnector().getExamController()
                .getPreviousMarks(PracticeExamLogIn.studentNic);
        for (Exam exam : setChartValue) {
            //dataset1.setValue(exam.getMarks(), "gfdg9", exam.getDate());
            pop.addOrUpdate(new Day(exam.getDate()), exam.getMarks());
            System.out.println("mar" + exam.getMarks());
            System.out.println("date" + exam.getDate());
        }
        TimeSeriesCollection myDataset = new TimeSeriesCollection();
        myDataset.addSeries(pop);
        JFreeChart myChart = ChartFactory.createTimeSeriesChart("Population Your Marks", "Date", "Population",
                myDataset, true, true, false);
        //try {
        //ChartUtilities.saveChartAsJPEG(new File("C:\\chart.jpg"), chart, 500, 300);
        //} catch (IOException e) {
        //System.err.println("Problem occurred creating chart.");
        //}

        //JFreeChart chart=ChartFactory.create
        CategoryPlot plot1 = freeChart.getCategoryPlot();
        plot1.setRangeGridlinePaint(Color.BLUE);
        //ChartFrame frame1 = new ChartFrame("Exam Prograss", freeChart1);

        //        frame.setVisible(true);
        //        frame.setSize(550, 450);
        // JPanel jPanel1 = new JPanel();
        jPanel2.setLayout(new java.awt.BorderLayout());

        ChartPanel CP1 = new ChartPanel(myChart);
        CP1.setPreferredSize(new Dimension(785, 440));
        CP1.setMouseWheelEnabled(true);

        jPanel2.add(CP1);
        jPanel2.revalidate();

    } catch (RemoteException | ClassNotFoundException | SQLException | NotBoundException
            | MalformedURLException ex) {
        Logger.getLogger(PrograssCharts.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createEvolution() {
    JFreeChart chart = ChartFactory.createXYLineChart("Evolution of Mean Agent Vision and Metabolism", "Time",
            "Level", model.evolution_vision_coll, PlotOrientation.VERTICAL, true, true, false);
    model.evolution_chart = chart;//w  w  w  . ja va 2 s  . com
    NumberAxis rangeAxis1 = new NumberAxis("Time");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart.getXYPlot();
    ValueAxis xAxis = plot.getDomainAxis();

    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.BLACK);
    plot.setDataset(1, model.evolution_metabolism_coll);
    renderer.setSeriesPaint(1, Color.BLUE);
    return chart;
}