Example usage for java.awt Color DARK_GRAY

List of usage examples for java.awt Color DARK_GRAY

Introduction

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

Prototype

Color DARK_GRAY

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

Click Source Link

Document

The color dark gray.

Usage

From source file:UserInterface.PublisherRole.ViewUserHabitsJPanel.java

private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("User Habits", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );//from w  w  w .  j av  a 2  s .c  o  m

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle(" ", new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:IHM.compargraph.java

/**
 *
 * @param title/* www.  j a  va 2 s. c o m*/
 * @param c1
 * @param c2
 * @param comp
 * 
 */
public compargraph(String title, ArrayList<ReleveMeteo> c1, ArrayList<ReleveMeteo> c2, String comp) {
    super(title);
    t1 = c1;
    t2 = c2;
    c = comp;

    // jp = new JInternalFrame("courbes");

    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(500, 300));
    setContentPane(panel);
    //  jp.add(panel, BorderLayout.EAST);
    //  jp.setVisible(true);
    panel.setVisible(true);
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    // sets thickness for series (using strokes)
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setRenderer(renderer);
    plot.setOutlinePaint(Color.BLUE);
    plot.setOutlineStroke(new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);

}

From source file:io.wcm.handler.media.impl.DummyImageServlet.java

@Override
protected Layer createLayer(ImageContext ctx) throws RepositoryException, IOException {
    SuffixParser parser = new SuffixParser(ctx.request);
    int width = parser.get(SUFFIX_WIDTH, 0);
    int height = parser.get(SUFFIX_HEIGHT, 0);
    String name = parser.get(SUFFIX_MEDIA_FORMAT_NAME, String.class);

    // validate with/height
    if (width < 1 || height < 1) {
        return new Layer(1, 1, null);
    }/*from w w  w.j  a v a  2 s.  c  o  m*/

    Layer textLayer = getTextLayer(width, height, name);

    int x = (width - textLayer.getWidth()) / 2;
    int y = (height - textLayer.getHeight()) / 2;

    Layer layer = new Layer(width, height, Color.GRAY);

    // we now build a grey box for the text which is slightly bigger than the text
    int backgroundOffset = width / 120;
    Layer textBackground = new Layer(textLayer.getWidth() + (backgroundOffset * 2),
            textLayer.getHeight() + (backgroundOffset * 2), Color.DARK_GRAY);
    layer.blit(textBackground, x - backgroundOffset, y - backgroundOffset, textBackground.getWidth(),
            textBackground.getHeight(), 0, 0);

    // now we can add the text
    layer.blit(textLayer, x, y, textLayer.getWidth(), textLayer.getHeight(), 0, 0);
    return layer;
}

From source file:com.griddynamics.jagger.diagnostics.visualization.GraphVisualizationHelper.java

public static <V, E> Image renderGraph(Graph<V, E> graph, int width, int height, GraphLayout graphLayout,
        final ColorTheme colorTheme, final Map<V, Paint> customNodeColors) {

    Layout<V, E> layout;/*www  .  ja  va  2s .  c  o m*/
    switch (graphLayout) {
    case CIRCLE:
        layout = new CircleLayout<V, E>(graph);
        break;
    case ISOM:
        layout = new ISOMLayout<V, E>(graph);
        break;
    case FR:
        layout = new FRLayout<V, E>(graph);
        break;
    case KK:
        layout = new KKLayout<V, E>(graph);
        break;
    default:
        throw new RuntimeException("Unknown Graph Layout : [" + graphLayout + "]");
    }

    layout.setSize(new Dimension((int) (width * (1 - IMAGE_HORIZONTAL_MARGIN)),
            (int) (height * (1 - IMAGE_VERTICAL_MARGIN))));

    VisualizationImageServer<V, E> server = new VisualizationImageServer<V, E>(displacementLayout(layout,
            (int) (width * IMAGE_HORIZONTAL_MARGIN / 2), (int) (height * IMAGE_VERTICAL_MARGIN / 2)),
            new Dimension(width, height));

    final Color edgeColor;
    switch (colorTheme) {
    case LIGHT:
        server.setBackground(Color.WHITE);
        edgeColor = Color.BLACK;
        break;
    case DARK:
        server.setBackground(Color.BLACK);
        edgeColor = Color.LIGHT_GRAY;
        break;
    default:
        throw new RuntimeException("Unknown Color Theme : [" + colorTheme + "]");
    }

    Transformer<V, Paint> vertexPaint = new Transformer<V, Paint>() {
        public Paint transform(V v) {
            Paint paint = customNodeColors.get(v);
            if (paint == null) {
                paint = Color.LIGHT_GRAY;
            }
            return paint;
        }
    };

    Transformer<V, Paint> vertexBorderPaint = new Transformer<V, Paint>() {
        public Paint transform(V v) {
            return Color.DARK_GRAY;
        }
    };

    Transformer<E, Paint> edgePaint = new Transformer<E, Paint>() {
        public Paint transform(E e) {
            return edgeColor;
        }
    };

    server.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    server.getRenderContext().setEdgeDrawPaintTransformer(edgePaint);
    server.getRenderContext().setArrowDrawPaintTransformer(edgePaint);
    server.getRenderContext().setArrowFillPaintTransformer(edgePaint);

    server.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>());
    server.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<E>());
    server.getRenderContext().setVertexDrawPaintTransformer(vertexBorderPaint);

    server.getRenderContext().setVertexLabelTransformer(new ChainedTransformer<V, String>(
            new Transformer[] { new ToStringLabeller<V>(), new Transformer<String, String>() {
                public String transform(String input) {
                    return "<html><center><p>" + formatLabel(input, MAX_LABEL_LENGTH);
                }
            } }));
    VertexLabelAsShapeRenderer<V, E> vlasr = new VertexLabelAsShapeRenderer<V, E>(server.getRenderContext());
    server.getRenderContext().setVertexShapeTransformer(vlasr);
    server.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);

    return server.getImage(new Point(0, 0), new Dimension(width, height));
}

From source file:org.jdal.swing.form.SimpleBoxFormBuilder.java

/**
 * Add a component to Form at position pointer by cursor, 
 * Increments cursor by one.//from w  w w  . j av a 2s  .c  o  m
 * @param c Component to add
 */
public void add(Component c) {
    if (debug) {
        if (c instanceof JComponent)
            ((JComponent) c).setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
    }
    addBox(c);

    if (rowHeight < Short.MAX_VALUE) {
        Dimension d = c.getPreferredSize();
        d.height = rowHeight;
        c.setPreferredSize(d);

        c.setMinimumSize(d);

        if (!c.isMaximumSizeSet() || c.getMaximumSize().getHeight() > rowHeight) {
            c.setMaximumSize(new Dimension(Short.MAX_VALUE, rowHeight));
        }
    }

}

From source file:PieChartDemo1.java

/**
 * Creates a chart.//  w  ww  . ja  v  a2s  .  c  o  m
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:org.slage.ui.ToolBarButton.java

/** Set default colors and font */
public void setDefaultLookAndFeel() {
    setForeground(Color.BLACK);/*from  w  w  w. j  a va2 s  .com*/
    setBackground(Color.DARK_GRAY);
    setFont(new Font("Arial", 1, 10));
    setRenderMode(ToolBar.RENDER_ICONS);
}

From source file:icaro.aplicaciones.recursos.recursoEstadistica.jFreeChart.demo.PieChartDemo1.java

/**
 * Creates a chart./*from  w w w.j av a 2  s  .  c om*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    //        plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:support.SystemMonitorGui.java

private XYPlot createChartFrame(XYSeries series) {
    XYSeriesCollection dataSet = new XYSeriesCollection();
    dataSet.addSeries(series);//from w w w . ja va  2 s  . c  om
    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:Main.java

@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle r) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Color color = null;/*from  w  w  w. ja  va 2 s.  c  o  m*/
    JScrollBar sb = (JScrollBar) c;
    if (!sb.isEnabled() || r.width > r.height) {
        return;
    } else if (isDragging) {
        color = Color.DARK_GRAY;
    } else if (isThumbRollover()) {
        color = Color.LIGHT_GRAY;
    } else {
        color = Color.GRAY;
    }
    g2.setPaint(color);
    g2.fillRoundRect(r.x, r.y, r.width, r.height, 10, 10);
    g2.setPaint(Color.WHITE);
    g2.drawRoundRect(r.x, r.y, r.width, r.height, 10, 10);
    g2.dispose();
}