Example usage for java.awt Color BLACK

List of usage examples for java.awt Color BLACK

Introduction

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

Prototype

Color BLACK

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

Click Source Link

Document

The color black.

Usage

From source file:Gui.Graficos.java

private void init(String titulo, String tituloX, String tituloY) {

    panel = new JPanel();
    panel.setBackground(Color.WHITE);

    getContentPane().add(panel);//  w  w w.  java 2s.c o m

    // Creando el Grafico

    JFreeChart chart = ChartFactory.createBarChart3D(titulo, tituloX, tituloY, dataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(new Color(225, 255, 228));
    chart.getTitle().setPaint(Color.black);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Mostrar Grafico

    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);

    // panel.setLayout(new VerticalLayout());

    panel.add(btAceptar);

    //panel.
    panel.setLayout(null);

    chartPanel.setBounds(100, 10, 1100, 600);
    btAceptar.setBounds(1065, 620, 130, 30);

}

From source file:josejamilena.pfc.analizador.GraficoPorSGBD.java

public GraficoPorSGBD(final String sgbd, final String script) throws ClassNotFoundException, SQLException {

    Map<String, String> res = new TreeMap<String, String>();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    Statement stmt = null;/*from  w ww.ja  v  a 2 s . c om*/
    ResultSet rs = null;
    String consulta = "select tiempo, fecha from estadisticas where tipo=\'" + script + "\' and host_sgbd=\'"
            + sgbd + "\'";
    stmt = App.conn.createStatement();
    rs = stmt.executeQuery(consulta);
    while (rs.next()) {
        res.put(rs.getString(2), rs.getString(1));
    }
    rs.close();
    stmt.close();

    Iterator it = res.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        dataset.setValue(Double.parseDouble(pairs.getValue().toString()), script, pairs.getKey().toString());
    }

    JFreeChart chart = ChartFactory.createBarChart(sgbd, // chart title
            "Hora", // domain axis label
            "Duracin (milisegundos)", // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, false, // include legend
            true, false);

    CategoryPlot plot = chart.getCategoryPlot();
    chart.setBackgroundPaint(Color.white);
    plot.setOutlinePaint(Color.black);
    ChartPanel chartPanel = new ChartPanel(chart);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.getViewport().add((new JPanel()).add(chartPanel));
    setContentPane(scrollPane);
}

From source file:net.sf.mzmine.chartbasics.chartthemes.EStandardChartTheme.java

public EStandardChartTheme(THEME themeID, String name) {
    super(name);/*w w  w  .  j av  a2s  .c  om*/
    this.themeID = themeID;

    setBarPainter(new StandardBarPainter());
    setXYBarPainter(new StandardXYBarPainter());

    // in theme
    setAntiAliased(false);
    setNoBackground(false);
    // general

    isAntiAliased = true;

    masterFont = new Font("Arial", Font.PLAIN, 11);
    masterFontColor = Color.black;
}

From source file:com.cedarsoft.test.io.CarSerializerTest.java

@Nonnull
@Override// w w  w.  j a v a2  s .  co m
protected Iterable<? extends Car> createObjectsToSerialize() {
    return Arrays.asList(new Car(new Model("Toyota"), Color.BLACK, new Money(49000, 00)),
            new Car(new Model("Ford"), Color.ORANGE, new Money(19000, 00),
                    Arrays.asList(new Extra("Whoo effect", new Money(99, 98)),
                            new Extra("Better Whoo effect", new Money(199, 00)))));
}

From source file:Classes_Home.CriarGrafico.java

public void criargrafico(JPanel jPanel3) {
        String pcs[] = { "'HP'", "'IBM'", "'LENOVO'", "'POSITIVO'", "'NACIONAL'" };
        for (int i = 0; i <= 4; i++) {
            String query = "SELECT * FROM `cpu` WHERE marca = " + pcs[i];

            try {
                st = connection.createStatement();
                rs = st.executeQuery(query);
                if (rs.last()) {
                    int aux = rs.getRow();
                    vetorParaGrafico[i] = aux;
                }//from   www .ja  v  a 2  s .co m
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.setValue(vetorParaGrafico[0], "Quantidade", "HP");
        dataset.setValue(vetorParaGrafico[1], "Quantidade", "IBM");
        dataset.setValue(vetorParaGrafico[2], "Quantidade", "LENOVO");
        dataset.setValue(vetorParaGrafico[3], "Quantidade", "POSITIVO");
        dataset.setValue(vetorParaGrafico[4], "Quantidade", "NACIONAL");

        JFreeChart chart = ChartFactory.createBarChart3D(null, null, "Quantidade", dataset,
                PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot p = chart.getCategoryPlot();
        CategoryItemRenderer renderer = p.getRenderer();
        renderer.setSeriesPaint(0, new Color(80, 151, 204));
        p.setRangeGridlinePaint(Color.BLACK);
        ChartPanel panel = new ChartPanel(chart);
        panel.setDomainZoomable(true);
        panel.setVisible(true);
        jPanel3.setLayout(new BorderLayout());
        jPanel3.add(panel, BorderLayout.CENTER);
        jPanel3.revalidate();
        jPanel3.repaint();
        System.gc();
    }

From source file:OptimalPrimitives.java

protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    long startTime, endTime, totalTime;

    g.setColor(Color.WHITE);/*from  w w w.j  av a  2  s .co  m*/
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(Color.BLACK);

    g.drawString("Bad vs. Good Primitive Rendering", 50, 20);
    g.drawString("(" + ITERATIONS + " iterations)", 100, 35);
    g.drawString("Bad: ", 10, BAD_Y + 30);
    g.drawString("Good: ", 10, GOOD_Y + 30);

    // Bad line
    Shape line = new Line2D.Double(LINE_X, BAD_Y, LINE_X + 50, BAD_Y + 50);
    startTime = System.nanoTime();
    for (int i = 0; i < ITERATIONS; ++i) {
        g2d.draw(line);
    }
    endTime = System.nanoTime();
    totalTime = (endTime - startTime) / 1000000;
    System.out.println("bad line = " + totalTime);
    g.drawString(totalTime + " ms", LINE_X, BAD_Y + 70);

    // Good line
    startTime = System.nanoTime();
    for (int i = 0; i < ITERATIONS; ++i) {
        g.drawLine(LINE_X, GOOD_Y, LINE_X + 50, GOOD_Y + 50);
    }
    endTime = System.nanoTime();
    totalTime = (endTime - startTime) / 1000000;
    System.out.println("good line = " + totalTime);
    g.drawString(totalTime + " ms", LINE_X, GOOD_Y + 70);

    // Bad rect
    Shape rect = new Rectangle(RECT_X, BAD_Y, 50, 50);
    startTime = System.nanoTime();
    for (int i = 0; i < ITERATIONS; ++i) {
        g2d.fill(rect);
    }
    endTime = System.nanoTime();
    totalTime = (endTime - startTime) / 1000000;
    System.out.println("bad rect = " + totalTime);
    g.drawString(totalTime + " ms", RECT_X, BAD_Y + 70);

    // Good rect
    startTime = System.nanoTime();
    for (int i = 0; i < ITERATIONS; ++i) {
        g.fillRect(RECT_X, GOOD_Y, 50, 50);
    }
    endTime = System.nanoTime();
    totalTime = (endTime - startTime) / 1000000;
    System.out.println("good rect = " + totalTime);
    g.drawString(totalTime + " ms", RECT_X, GOOD_Y + 70);
}

From source file:com.floreantpos.swing.ShopTableButton.java

public void update() {
    if (shopTable != null && shopTable.isServing()) {
        //setEnabled(false);
        setBackground(Color.red);
        setForeground(Color.BLACK);
    } else if (shopTable != null && shopTable.isBooked()) {
        setEnabled(false);// w w w .  j av a 2 s.  c  om
        setOpaque(true);
        setBackground(Color.orange);
        setForeground(Color.BLACK);
    } else {
        setEnabled(true);
        setBackground(Color.white);
        setForeground(Color.black);
    }
}

From source file:josejamilena.pfc.analizador.GraficoPorCliente.java

public GraficoPorCliente(final String cliente, final String script)
        throws ClassNotFoundException, SQLException {

    Map<String, String> res = new TreeMap<String, String>();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    Statement stmt = null;//from w w  w. j ava 2  s.c  o m
    ResultSet rs = null;
    String consulta = "select tiempo, fecha from estadisticas where tipo=\'" + script + "\' and host_cliente=\'"
            + cliente + "\'";
    stmt = App.conn.createStatement();
    rs = stmt.executeQuery(consulta);
    while (rs.next()) {
        res.put(rs.getString(2), rs.getString(1));
    }
    rs.close();
    stmt.close();

    Iterator it = res.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        dataset.setValue(Double.parseDouble(pairs.getValue().toString()), script, pairs.getKey().toString());
    }

    JFreeChart chart = ChartFactory.createBarChart(cliente, // chart title
            "Hora", // domain axis label
            "Duracin (milisegundos)", // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, false, // include legend
            true, false);

    CategoryPlot plot = chart.getCategoryPlot();
    chart.setBackgroundPaint(Color.white);
    plot.setOutlinePaint(Color.black);
    ChartPanel chartPanel = new ChartPanel(chart);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.getViewport().add((new JPanel()).add(chartPanel));
    setContentPane(scrollPane);
}

From source file:jgnash.ui.budget.BudgetSparkline.java

public static Icon getSparklineImage(final List<BigDecimal> amounts) {

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    final boolean[] negate = new boolean[amounts.size()];

    for (int i = 0; i < amounts.size(); i++) {
        dataset.addValue(amounts.get(i), CATEGORY, i);
        negate[i] = amounts.get(i).signum() == -1;
    }//w  w w.  j  av a 2  s  .  co m

    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setTickLabelsVisible(false);
    xAxis.setTickMarksVisible(false);
    xAxis.setAxisLineVisible(false);
    xAxis.setVisible(false);

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelsVisible(false);
    yAxis.setTickMarksVisible(false);
    yAxis.setAxisLineVisible(false);
    yAxis.setNegativeArrowVisible(false);
    yAxis.setPositiveArrowVisible(false);
    yAxis.setAutoRangeIncludesZero(true);
    yAxis.setAutoRange(true);
    yAxis.setVisible(false);

    BarRenderer renderer = new BarRenderer() {

        @Override
        public Paint getItemPaint(final int row, final int column) {
            return negate[column] ? Color.RED : Color.BLACK;
        }
    };

    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardBarPainter());

    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
    plot.setInsets(INSETS);
    plot.setDomainGridlinesVisible(false);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setBackgroundPaint(CLEAR);

    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    chart.setBorderVisible(false);
    chart.setBackgroundPaint(CLEAR);

    Icon icon = EMPTY_ICON;

    try {
        byte[] image = ENCODER
                .encode(chart.createBufferedImage(DEFAULT_WIDTH, DEFAULT_HEIGHT, BufferedImage.BITMASK, null));
        icon = new ImageIcon(image);
    } catch (IOException ex) {
        Logger.getLogger(BudgetSparkline.class.getName()).log(Level.SEVERE, null, ex);
    }

    return icon;
}

From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.BulletGraph.java

public JFreeChart createChart() {

    logger.debug("IN");
    Number value = null;// ww  w .j  a  v  a  2  s. c  o m

    if (dataset == null) {
        logger.debug("The dataset to be represented is null");
        value = new Double(0);
    } else {
        value = dataset.getValue();
    }

    DefaultCategoryDataset datasetC = new DefaultCategoryDataset();
    datasetC.addValue(value, "", "");

    // customize a bar chart 
    JFreeChart chart = ChartFactory.createBarChart(null, null, null, datasetC, PlotOrientation.HORIZONTAL,
            false, false, false);
    chart.setBorderVisible(false);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOutlineVisible(true);
    plot.setOutlinePaint(Color.BLACK);

    plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setBackgroundPaint(null);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setAnchorValue(value.doubleValue());

    // add the target marker 
    if (target != null) {
        ValueMarker marker = new ValueMarker(target.doubleValue(), Color.BLACK, new BasicStroke(2.0f));
        plot.addRangeMarker(marker, Layer.FOREGROUND);
    }

    //sets different marks
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        // add the marks 
        IntervalMarker marker = new IntervalMarker(interval.getMin(), interval.getMax(), interval.getColor());
        plot.addRangeMarker(marker, Layer.BACKGROUND);
        logger.debug("Added new interval to the plot");
    }

    // customize axes 
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setVisible(show_axis);
    rangeAxis.setLabelFont(new Font("Arial", Font.PLAIN, 4));
    // calculate the upper limit 
    //double upperBound = target * upperFactor; 
    rangeAxis.setRange(new Range(lower, upper));
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // customize renderer 
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaximumBarWidth(0.18);
    renderer.setSeriesPaint(0, Color.BLACK);
    /*BasicStroke d = new BasicStroke(3f,BasicStroke.CAP_ROUND ,BasicStroke.JOIN_ROUND);
    renderer.setSeriesOutlineStroke(0, d);
    renderer.setSeriesStroke(0, d);
            
    renderer.setStroke(d);*/

    return chart;
}