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:com.bdb.weather.display.windrose.WindRosePlot.java

/**
 * Constructor./*from ww w .  j  a v a 2 s.com*/
 */
public WindRosePlot() {
    super();

    NumberAxis axis = new NumberAxis("%");
    axis.setTickUnit(new NumberTickUnit(10.0));
    setAxis(axis);

    renderer = new CompassPolarItemRenderer();
    renderer.setBasePaint(Color.black);
    renderer.setShapesVisible(false);
    renderer.setDrawOutlineWhenFilled(false);
    renderer.setFillComposite(AlphaComposite.Src);
    setRenderer(renderer);
    setAngleGridlinesVisible(true);
    setAngleGridlinePaint(Color.black);
    setRadiusGridlinesVisible(true);
    setRadiusGridlinePaint(Color.BLACK);
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.boxcharts.SimpleBox.java

public JFreeChart createChart(DatasetMap datasetMap) {

    BoxAndWhiskerCategoryDataset dataset = (BoxAndWhiskerCategoryDataset) datasetMap.getDatasets().get("1");

    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(name, categoryLabel, valueLabel, dataset, false);

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);/*from  w w w .  j a  v a  2 s  . co m*/
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    BoxAndWhiskerRenderer renderer = (BoxAndWhiskerRenderer) plot.getRenderer();
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(new Color(Integer.decode("#c0c0c0").intValue()));
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    renderer.setFillBox(true);
    renderer.setArtifactPaint(Color.BLACK);
    renderer.setSeriesPaint(0, new Color(Integer.decode("#0000FF").intValue()));

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(min, max);

    return chart;
}

From source file:ca.sqlpower.wabit.swingui.report.selectors.FancyDateSelectorField.java

private void refreshEverything() {

    if (getDate() == null) {
        setDate((Date) selector.getDefaultValue());
    }//  www  . j  av a  2  s  . co m

    if (ObjectUtils.equals(getDate(), selector.getDefaultValue())) {
        selector.setSelectedValue(null);
        setForeground(Color.GRAY);
        setFont(getFont().deriveFont(Font.ITALIC));
    } else {
        selector.setSelectedValue(getDate());
        setForeground(Color.BLACK);
        setFont(getFont().deriveFont(Font.PLAIN));
    }
    SwingUtilities.invokeLater(refreshRoutine);
}

From source file:net.sf.jasperreports.chartthemes.provider.BlockBorderProvider.java

@Override
public BlockFrame getBlockFrame() {
    Paint borderPaint = paint == null ? null : paint.getPaint();

    BlockBorder border;/*from   w w w .ja v  a  2 s. c om*/
    if (insets == null) {
        if (paint == null) {
            border = new BlockBorder();
        } else {
            border = new BlockBorder(borderPaint);
        }
    } else {
        if (borderPaint == null) {
            border = new BlockBorder(insets, Color.black);
        } else {
            border = new BlockBorder(insets, borderPaint);
        }
    }
    return border;
}

From source file:graficarordenamiento.Graficador.java

public void crearGrafico() {
    // Creando el Grafico
    chart = ChartFactory.createBarChart("Grfico de barras", null, null, dataset, PlotOrientation.VERTICAL,
            false, false, false);/*from   ww w  .jav  a2  s  .  c o m*/

    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.WHITE, 700, 0, Color.BLACK.brighter(), false));
    chart.setBackgroundImageAlpha(0.5f);
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");
    plot.setRangeGridlinePaint(Color.red);
    plot.setBackgroundPaint(new GradientPaint(0, 0, Color.LIGHT_GRAY, 0, 100, Color.darkGray));
    plot.setBackgroundImageAlpha(0.5f);
    //plot.setDomainGridlinesVisible(true);

    BarRenderer rend = (BarRenderer) plot.getRenderer();

    final ItemLabelPosition e = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
            TextAnchor.CENTER, 45.0);

    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));

    rend.setSeriesPaint(0, gp0);
    rend.setSeriesPaint(1, gp1);
    rend.setSeriesPaint(2, gp2);
    plot.setRenderer(rend);

    // change the margin at the top of the range axis...
    final ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    // set up gradient paints for series...

}

From source file:PerformanceGraph.java

/**
 * Plots the performance graph of the best fitness value so far versus the
 * number of function calls (NFC).//w  w  w. j a v  a2 s . co  m
 * 
 * @param bestFitness A linked hashmap mapping the NFC to the best fitness value
 * found so far.
 * @param fitnessFunction The name of the fitness function, used for the title and the
 * name of the file that is saved, e.g. "De Jong".
 */
public static void plot(LinkedHashMap<Integer, Double> bestFitness, String fitnessFunction) {
    /* Create an XYSeries plot */
    XYSeries series = new XYSeries("Best Fitness Value Vs. Number of Function Calls");

    /* Add the NFC and best fitness value data to the series */
    for (Integer NFC : bestFitness.keySet()) {
        /* Jfreechart crashes if double values are too large! */
        if (bestFitness.get(NFC) <= 10E12) {
            series.add(NFC.doubleValue(), bestFitness.get(NFC).doubleValue());
        }
    }

    /* Add the x,y series data to the dataset */
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    /* Plot the data as an X,Y line chart */
    JFreeChart chart = ChartFactory.createXYLineChart("Best Fitness Value Vs. Number of Function Calls",
            "Number of Function Calls (NFC)", "Best Fitness Value", dataset, PlotOrientation.VERTICAL, false,
            true, false);

    /* Configure the chart settings such as anti-aliasing, background colour */
    chart.setAntiAlias(true);

    XYPlot plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);
    plot.setDomainGridlinePaint(Color.black);

    /* Set the domain range from 0 to NFC */
    NumberAxis domain = (NumberAxis) plot.getDomainAxis();
    domain.setRange(0.0, ControlVariables.MAX_FUNCTION_CALLS.doubleValue());

    /* Logarithmic range axis */
    plot.setRangeAxis(new LogAxis());

    /* Set the thickness and colour of the lines */
    XYItemRenderer renderer = plot.getRenderer();
    BasicStroke thickLine = new BasicStroke(3.0f);
    renderer.setSeriesStroke(0, thickLine);
    renderer.setPaint(Color.BLACK);

    /* Display the plot in a JFrame */
    ChartFrame frame = new ChartFrame(fitnessFunction + " Best Fitness Value", chart);
    frame.setVisible(true);
    frame.setSize(1000, 600);

    /* Save the plot as an image named after fitness function
    try
    {
       ChartUtilities.saveChartAsJPEG(new File("plots/" + fitnessFunction + ".jpg"), chart, 1600, 900);
    }
    catch (IOException e)
    {
       e.printStackTrace();
    }*/
}

From source file:jesse.GA_ANN.DataVis.java

JFreeChart createChart()//Here Input MillSecond
{
    total = new XYSeries[10];
    XYSeriescollection = new XYSeriesCollection();
    for (int i = 0; i < 10; i++) {
        total[i] = new XYSeries(i);
        XYSeriescollection.addSeries(total[i]);
    }/*  www. j  a  v a  2 s.  c om*/

    dateaxis = new NumberAxis("Time");
    NumberAxis Conaxis = new NumberAxis("z??");
    dateaxis.setAutoRange(true);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    dateaxis.setTickLabelsVisible(true);
    xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
    xylineandshaperenderer.setSeriesPaint(0, Color.green);
    xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 2));
    xylineandshaperenderer.setFillPaint(new Color(30, 30, 220), true);

    Conaxis.setRange(-1, 1);
    Conaxis.setAutoRange(true);
    Conaxis.setAutoRangeIncludesZero(false);

    XYPlot xyplot = new XYPlot(XYSeriescollection, dateaxis, Conaxis, xylineandshaperenderer);
    JFreeChart jfreechart = new JFreeChart("time-z", new Font("Arial", 1, 24), xyplot, true);
    ChartUtilities.applyCurrentTheme(jfreechart);
    ChartPanel chartpanel = new ChartPanel(jfreechart, true);
    chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    return jfreechart;
}

From source file:EditorPaneExample10A.java

public EditorPaneExample10A() {
    super("JEditorPane Example 10 - using getIterator");

    pane = new JEditorPane();
    pane.setEditable(false); // Read-only
    getContentPane().add(new JScrollPane(pane), "Center");

    // Build the panel of controls
    JPanel panel = new JPanel();

    panel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridwidth = 1;/*from   w  w w. j  av a2s  . c o  m*/
    c.gridheight = 1;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.weighty = 0.0;

    JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT);
    panel.add(urlLabel, c);
    JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT);
    c.gridy = 1;
    panel.add(loadingLabel, c);
    JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT);
    c.gridy = 2;
    panel.add(typeLabel, c);
    c.gridy = 3;
    panel.add(new JLabel(LOAD_TIME), c);

    c.gridy = 4;
    c.gridwidth = 2;
    c.weightx = 1.0;
    c.anchor = GridBagConstraints.WEST;
    onlineLoad = new JCheckBox("Online Load");
    panel.add(onlineLoad, c);
    onlineLoad.setSelected(true);
    onlineLoad.setForeground(typeLabel.getForeground());

    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;

    urlCombo = new JComboBox();
    panel.add(urlCombo, c);
    urlCombo.setEditable(true);
    loadingState = new JLabel(spaces, JLabel.LEFT);
    loadingState.setForeground(Color.black);
    c.gridy = 1;
    panel.add(loadingState, c);
    loadedType = new JLabel(spaces, JLabel.LEFT);
    loadedType.setForeground(Color.black);
    c.gridy = 2;
    panel.add(loadedType, c);
    timeLabel = new JLabel("");
    c.gridy = 3;
    panel.add(timeLabel, c);

    getContentPane().add(panel, "South");

    // Change page based on combo selection
    urlCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (populatingCombo == true) {
                return;
            }
            Object selection = urlCombo.getSelectedItem();
            try {
                // Check if the new page and the old
                // page are the same.
                URL url;
                if (selection instanceof URL) {
                    url = (URL) selection;
                } else {
                    url = new URL((String) selection);
                }

                URL loadedURL = pane.getPage();
                if (loadedURL != null && loadedURL.sameFile(url)) {
                    return;
                }

                // Try to display the page
                urlCombo.setEnabled(false); // Disable input
                urlCombo.paintImmediately(0, 0, urlCombo.getSize().width, urlCombo.getSize().height);
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // Busy cursor
                loadingState.setText("Loading...");
                loadingState.paintImmediately(0, 0, loadingState.getSize().width,
                        loadingState.getSize().height);
                loadedType.setText("");
                loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height);

                timeLabel.setText("");
                timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height);

                startTime = System.currentTimeMillis();

                // Choose the loading method
                if (onlineLoad.isSelected()) {
                    // Usual load via setPage
                    pane.setPage(url);
                    loadedType.setText(pane.getContentType());
                } else {
                    pane.setContentType("text/html");
                    loadedType.setText(pane.getContentType());
                    if (loader == null) {
                        loader = new HTMLDocumentLoader();
                    }
                    HTMLDocument doc = loader.loadDocument(url);
                    loadComplete();
                    pane.setDocument(doc);
                    displayLoadTime();
                    populateCombo(findLinks(doc, null));
                    enableInput();
                }
            } catch (Exception e) {
                System.out.println(e);
                JOptionPane.showMessageDialog(pane,
                        new String[] { "Unable to open file", selection.toString() }, "File Open Error",
                        JOptionPane.ERROR_MESSAGE);
                loadingState.setText("Failed");
                enableInput();
            }
        }
    });

    // Listen for page load to complete
    pane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("page")) {
                loadComplete();
                displayLoadTime();
                populateCombo(findLinks(pane.getDocument(), null));
                enableInput();
            }
        }
    });
}

From source file:bayesGame.ui.painter.OrNodePainter.java

public static Image paintPercentage(Color gridColor, Color falseColor, int size, int squaresize, BayesNode node,
        Fraction parentNode1Probability, Fraction parentNode2Probability) {

    BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
    Graphics g = img.getGraphics();

    NodePainter.graphicBackgroundPainter(g, 0, 0, size, size);

    // get non-zero truth table entries from the node
    List<Map<Object, Boolean>> nonZeroEntries = node.getNonZeroProbabilities();

    // get the identities of its parents by taking the first map and querying it 
    // for KeySet, subtracting the object representing the node itself
    Set<Object> nodeParents = nonZeroEntries.get(0).keySet();
    nodeParents.remove(node.type);// www  . j  a  v  a  2  s  . c o m

    if (nodeParents.size() > 2) {
        throw new IllegalArgumentException("OR node with more than 2 parents not yet implemented");
    }

    Object[] nodeParentsArray = nodeParents.toArray();
    Object parent1 = nodeParentsArray[0];
    Object parent2 = nodeParentsArray[1];

    // for each map, check the truth table entry it corresponds to and color
    // those appropriately
    boolean p1true_p2true = false;
    boolean p1true_p2false = false;
    boolean p1false_p2true = false;
    boolean p1false_p2false = false;

    for (Map<Object, Boolean> map : nonZeroEntries) {
        Boolean parent1truth = map.get(parent1);
        Boolean parent2truth = map.get(parent2);

        if (parent1truth && parent2truth) {
            p1true_p2true = true;
        } else if (parent1truth && !parent2truth) {
            p1true_p2false = true;
        } else if (!parent1truth && parent2truth) {
            p1false_p2true = true;
        } else if (!parent1truth && !parent2truth) {
            p1false_p2false = true;
        }
    }

    int XSize = parentNode1Probability.multiply(size).intValue();
    int X_Size = size - XSize;
    int YSize = parentNode2Probability.multiply(size).intValue();
    int Y_Size = size - YSize;

    if (p1true_p2true) {
        NodePainter.squarePainter(g, 0, 0, XSize, YSize, gridColor, Color.BLACK);
    } else {
        NodePainter.squarePainter(g, 0, 0, XSize, YSize, NodePainter.RECTANGLE_BOX_BACKGROUND_COLOR,
                Color.BLACK);
    }

    NodePainter.squarePainter(g, XSize, 0, X_Size, YSize, gridColor, Color.BLACK);
    NodePainter.squarePainter(g, 0, YSize, XSize, Y_Size, gridColor, Color.BLACK);

    if (p1false_p2false) {
        NodePainter.squarePainter(g, XSize, YSize, X_Size, Y_Size, falseColor, Color.BLACK);
    } else {
        NodePainter.squarePainter(g, XSize, YSize, X_Size, Y_Size, NodePainter.RECTANGLE_BOX_BACKGROUND_COLOR,
                Color.BLACK);
    }

    return img;
}

From source file:com.foudroyantfactotum.mod.fousarchive.midi.generation.MidiImageGeneration.java

public ImmutablePair<String, BufferedImage> buildImage() throws InterruptedException, ExecutionException {
    final Future<String> name = pool.submit(new LineProcessor(imgX));
    final BufferedImage mdbf = new BufferedImage(imgX, imgY, BufferedImage.TYPE_BYTE_GRAY);
    final Graphics g = mdbf.getGraphics();

    g.setColor(Color.BLACK);
    g.fillRect(0, 0, imgX, imgY);/*from w  w w . java  2  s . c o m*/
    g.setColor(Color.WHITE);

    for (Line l = lines.take(); l != TERMINATE; l = lines.take()) {
        g.drawLine(l.note, (int) Math.round(l.tickStart * imgY), l.note, (int) Math.round(l.tickEnd * imgY));
    }

    pool.shutdown();

    g.dispose();

    return ImmutablePair.of(name.get(), mdbf);
}