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:RendererSample.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);//from   ww w  .j ava2  s .co m
    ((JLabel) renderer).setOpaque(true);
    Color foreground, background;
    if (isSelected) {
        foreground = Color.yellow;
        background = Color.green;
    } else {
        if (row % 2 == 0) {
            foreground = Color.blue;
            background = Color.white;
        } else {
            foreground = Color.white;
            background = Color.blue;
        }
    }
    renderer.setForeground(foreground);
    renderer.setBackground(background);
    return renderer;
}

From source file:com.mycompany.istudy.principalservices.GraphicalView.java

/**
 * Overwrites the method of createXYLineChart from ChartFactory interface
 * and creates a XYLine Chart.// ww w.ja v a  2 s  .c o  m
 * @param applicationTitle
 * @param chartTitle
 * @param investedHoursPerWeek
 * @param hoursToBeInvested 
 */
public GraphicalView(String applicationTitle, String chartTitle, Map<Double, Double> investedHoursPerWeek,
        Map<Double, Double> hoursToBeInvested) {
    super(applicationTitle);
    xylineChart = ChartFactory.createXYLineChart(chartTitle, "Calender Weeks", "Invested Study-hours",
            createDataset(investedHoursPerWeek, hoursToBeInvested), PlotOrientation.VERTICAL, true, true,
            false);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.RED);
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    plot.setRenderer(renderer);
    setContentPane(chartPanel);
}

From source file:graficos.GenerarGraficoInventario.java

public void crear() {
    try {/*from ww  w  . jav a2 s .c o m*/
        Dba db = new Dba(pathdb);
        db.conectar();
        String sql = "select Nombre, CantidadDisponibles, CantidadEnUso from Activos";
        db.prepare(sql);
        db.query.execute();
        ResultSet rs = db.query.getResultSet();
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        while (rs.next()) {
            int total = rs.getInt(2) + rs.getInt(3);
            dataset.setValue(total, "Cantidad", rs.getString(1));
        }

        JFreeChart chart = ChartFactory.createBarChart3D("Inventario de Activos del Hotel", "Activo",
                "Cantidad", dataset, PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph
        p.setBackgroundPaint(Color.black);
        ((BarRenderer) p.getRenderer()).setBarPainter(new StandardBarPainter());

        BarRenderer r = (BarRenderer) chart.getCategoryPlot().getRenderer();
        r.setSeriesPaint(0, Color.BLUE);

        try {
            ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300);
        } catch (Exception ee) {
            System.err.println(ee.toString());
            System.err.println("Problem occurred creating chart.");
        }

        db.desconectar();
    } catch (Exception e) {

    }

}

From source file:ToolBarTest.java

public ToolBarFrame() {
    setTitle("ToolBarTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // add a panel for color change

    panel = new JPanel();
    add(panel, BorderLayout.CENTER);

    // set up actions

    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action yellowAction = new ColorAction("Yellow", new ImageIcon("yellow-ball.gif"), Color.YELLOW);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    Action exitAction = new AbstractAction("Exit", new ImageIcon("exit.gif")) {
        public void actionPerformed(ActionEvent event) {
            System.exit(0);/*from  w  ww . j ava 2s . com*/
        }
    };
    exitAction.putValue(Action.SHORT_DESCRIPTION, "Exit");

    // populate tool bar

    JToolBar bar = new JToolBar();
    bar.add(blueAction);
    bar.add(yellowAction);
    bar.add(redAction);
    bar.addSeparator();
    bar.add(exitAction);
    add(bar, BorderLayout.NORTH);

    // populate menu

    JMenu menu = new JMenu("Color");
    menu.add(yellowAction);
    menu.add(blueAction);
    menu.add(redAction);
    menu.add(exitAction);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(menu);
    setJMenuBar(menuBar);
}

From source file:com.google.code.facebook.graph.sna.applet.VisualizationImageServerDemo.java

/**
 * //w w  w.  j a v  a 2  s.  c  o  m
 */
public VisualizationImageServerDemo() {

    // create a simple graph for the demo
    graph = new DirectedSparseMultigraph<String, Number>();
    String[] v = createVertices(10);
    createEdges(v);

    vv = new VisualizationImageServer<String, Number>(new KKLayout<String, Number>(graph),
            new Dimension(600, 600));

    vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.white, Color.red,
            Color.white, Color.blue, vv.getPickedVertexState(), false));
    vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.lightGray));

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    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();

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Image im = vv.getImage(new Point2D.Double(300, 300), new Dimension(600, 600));
    Icon icon = new ImageIcon(im);
    JLabel label = new JLabel(icon);
    content.add(label);
    frame.pack();
    frame.setVisible(true);
}

From source file:loadmaprenderer.ChartTest.java

private JFreeChart makeChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Cost/Year Chart", "Year", "Cost", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = chart.getXYPlot();// ww w . j  a v  a 2  s.  c o m
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.BLUE);
    plot.setRangeGridlinePaint(Color.BLUE);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRange(rootPaneCheckingEnabled);
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRange(rootPaneCheckingEnabled);
    return chart;
}

From source file:de.fub.maps.gpx.analysis.ui.charts.LineChart.java

/**
 * Creates new form LineChart// w ww  . ja  v a 2s.  com
 */
public LineChart() {
    initComponents();
    chart = ChartFactory.createXYLineChart(null, NbBundle.getMessage(LineChart.class, "LineChart.Domain.Name"),
            NbBundle.getMessage(LineChart.class, "LineCHart.Value.Name"), dataset, PlotOrientation.VERTICAL,
            false, true, true);

    plot = chart.getXYPlot();
    plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT);
    plot.setBackgroundPaint(Color.white);
    plot.getRenderer(0).setSeriesPaint(0, Color.BLUE);
    plot.getRenderer(0).setSeriesShape(0, new Ellipse2D.Double(0, 0, 2, 2));
    plot.getRenderer(0).setBaseShape(new Ellipse2D.Double(0, 0, 2, 2));

    chartPanel = new ChartPanel(chart, false);
    add(chartPanel, BorderLayout.CENTER);
}

From source file:com.mugarov.neview.view.GraphPanel.java

public GraphPanel() {
    super(new BorderLayout());
    super.setBackground(Color.blue);

    this.colorGen = new ColorGenerator();

    this.content = new JPanel(new BorderLayout());
    this.scroll = new JScrollPane(this.content);

    this.add(this.scroll, BorderLayout.CENTER);
    this.dotSeries = new ArrayList<>();
    this.lineSeries = new ArrayList<>();
    this.coordinates = new ArrayList<>();
}

From source file:ActionTest.java

public ActionFrame() {
    setTitle("ActionTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    buttonPanel = new JPanel();

    // define actions
    Action yellowAction = new ColorAction("Yellow", new ImageIcon("yellow-ball.gif"), Color.YELLOW);
    Action blueAction = new ColorAction("Blue", new ImageIcon("blue-ball.gif"), Color.BLUE);
    Action redAction = new ColorAction("Red", new ImageIcon("red-ball.gif"), Color.RED);

    // add buttons for these actions
    buttonPanel.add(new JButton(yellowAction));
    buttonPanel.add(new JButton(blueAction));
    buttonPanel.add(new JButton(redAction));

    // add panel to frame
    add(buttonPanel);//  w  w w  .ja va  2 s .c  om

    // associate the Y, B, and R keys with names
    InputMap imap = buttonPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    imap.put(KeyStroke.getKeyStroke("ctrl Y"), "panel.yellow");
    imap.put(KeyStroke.getKeyStroke("ctrl B"), "panel.blue");
    imap.put(KeyStroke.getKeyStroke("ctrl R"), "panel.red");

    // associate the names with actions
    ActionMap amap = buttonPanel.getActionMap();
    amap.put("panel.yellow", yellowAction);
    amap.put("panel.blue", blueAction);
    amap.put("panel.red", redAction);
}

From source file:org.jfree.chart.demo.PeriodAxisDemo1.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  ww  w  .j a  va  2s  .  co m
    PeriodAxis periodaxis = new PeriodAxis("Date");
    periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Month.class);
    periodaxis.setMajorTickTimePeriodClass(org.jfree.data.time.Month.class);
    PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2];
    aperiodaxislabelinfo[0] = 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[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class,
            new SimpleDateFormat("yyyy"));
    periodaxis.setLabelInfo(aperiodaxislabelinfo);
    xyplot.setDomainAxis(periodaxis);
    return jfreechart;
}