Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

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

Prototype

Color gray

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

Click Source Link

Document

The color gray.

Usage

From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java

/**
 * //from w w  w. ja v  a 2 s  . co  m
 * @param components
 * @return
 */
public static JPanel actionPanel(final JComponent... components) {

    final JPanel panel = ComponentFactory.createPanel();
    panel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY));

    for (final JComponent component : components) {
        panel.add(component);
    }

    return panel;
}

From source file:graph_line.java

public void addMarkers(double peak) {
    if (_active > 0) {
        Marker m1 = new ValueMarker(peak);
        m1.setStroke(new BasicStroke((float) .5));
        m1.setPaint(Color.GRAY);
        plot.addDomainMarker(m1);//w  ww .j  a v a 2 s .c o m
    }
}

From source file:com.bdb.weather.display.current.Thermometer.java

private ChartViewer createChartElements() {
    thermometerPlot//  w w w .  j av a  2  s.c o m
            .setMercuryPaint(new GradientPaint(0.0f, 0.0f, Color.RED.darker(), 5.0f, 5.0f, Color.RED, true));
    thermometerPlot.setUseSubrangePaint(false);
    thermometerPlot.setBulbRadius(15);
    thermometerPlot.setColumnRadius(10);
    thermometerPlot.setValueLocation(ThermometerPlot.RIGHT);
    thermometerPlot.setValuePaint(Color.BLACK);
    thermometerPlot.setSubrange(0, 80.0, 80.0);
    thermometerPlot.setSubrangePaint(0, Color.BLUE);
    thermometerPlot.setSubrangePaint(1, Color.RED);
    thermometerPlot.setSubrange(1, 1000.0, 1000.0);
    thermometerPlot.setSubrange(2, 1000.0, 1000.0);
    thermometerPlot.setBackgroundPaint(Color.GRAY);
    thermometerPlot.setOutlineVisible(false);
    thermometerPlot.setValueFont(thermometerPlot.getValueFont().deriveFont(14.0F).deriveFont(Font.PLAIN));

    chart = new JFreeChart(thermometerPlot);
    chart.setTitle(titleProperty.getValue());
    chart.setBackgroundPaint(Color.GRAY);

    ChartViewer chartViewer = new ChartViewer(chart);
    chartViewer.setMinHeight(75);
    chartViewer.setMinWidth(25);
    return chartViewer;
}

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

/**
 * create an instance of a simple graph with basic controls
 *///ww  w  .  j  a  va 2 s  .c o m
public VertexLabelAsShapeDemo() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();

    layout = new FRLayout<String, Number>(graph);

    Dimension preferredSize = new Dimension(400, 400);
    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            layout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);

    // this class will provide both label drawing and vertex shapes
    VertexLabelAsShapeRenderer<String, Number> vlasr = new VertexLabelAsShapeRenderer<String, Number>(
            vv.getRenderContext());

    // customize the render context
    vv.getRenderContext().setVertexLabelTransformer(
            // this chains together Transformers so that the html tags
            // are prepended to the toString method output
            new ChainedTransformer<String, String>(
                    new Transformer[] { new ToStringLabeller<String>(), new Transformer<String, String>() {
                        public String transform(String input) {
                            return "<html><center>Vertex<p>" + input;
                        }
                    } }));
    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red));
    vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.yellow));
    vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(2.5f)));

    // customize the renderer
    vv.getRenderer()
            .setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.gray, Color.white, true));
    vv.getRenderer().setVertexLabelRenderer(vlasr);

    vv.setBackground(Color.black);

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<String>());

    final DefaultModalGraphMouse<String, Number> graphMouse = new DefaultModalGraphMouse<String, Number>();

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    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();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    zoomControls.add(plus);
    zoomControls.add(minus);
    controls.add(zoomControls);
    controls.add(modeBox);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:net.imglib2.script.analysis.BarChart.java

static private void setBackgroundDefault(final JFreeChart chart) {
    BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 2.0f, 1.0f }, 0.0f);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setRangeGridlineStroke(gridStroke);
    plot.setDomainGridlineStroke(gridStroke);
    plot.setBackgroundPaint(new Color(235, 235, 235));
    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setOutlineVisible(false);//w  ww.j  a v  a 2 s  .  c om
    plot.getDomainAxis().setAxisLineVisible(false);
    plot.getRangeAxis().setAxisLineVisible(false);
    plot.getDomainAxis().setLabelPaint(Color.gray);
    plot.getRangeAxis().setLabelPaint(Color.gray);
    plot.getDomainAxis().setTickLabelPaint(Color.gray);
    plot.getRangeAxis().setTickLabelPaint(Color.gray);
    chart.getTitle().setPaint(Color.gray);
}

From source file:org.matsim.contrib.socnetsim.usage.analysis.CourtesyHistogramListener.java

static JFreeChart getGraphic(final CourtesyHistogram.DataFrame dataFrame, int iteration, String actType) {
    final XYSeriesCollection xyData = new XYSeriesCollection();
    final XYSeries helloSeries = new XYSeries("hello", false, true);
    final XYSeries goodbyeSerie = new XYSeries("goodbye", false, true);
    final XYSeries togetherSerie = new XYSeries("pairs together", false, true);
    int together = 0;
    for (int i = 0; i < dataFrame.countsHello.length; i++) {
        together = together + dataFrame.countsHello[i] - dataFrame.countsGoodbye[i];
        double hour = i * dataFrame.binSize / 60.0 / 60.0;
        helloSeries.add(hour, dataFrame.countsHello[i]);
        goodbyeSerie.add(hour, dataFrame.countsGoodbye[i]);
        togetherSerie.add(hour, together);
    }/*  w w w . ja  v a  2s.  c om*/

    xyData.addSeries(helloSeries);
    xyData.addSeries(goodbyeSerie);
    xyData.addSeries(togetherSerie);

    final JFreeChart chart = ChartFactory.createXYStepChart(
            "Courtesy Statistics," + "actType " + actType + " it." + iteration, "time", "# persons", xyData,
            PlotOrientation.VERTICAL, true, // legend
            false, // tooltips
            false // urls
    );

    XYPlot plot = chart.getXYPlot();

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    plot.setDomainAxis(new NumberAxis("time"));

    plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f));
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setDomainGridlinePaint(Color.gray);

    return chart;
}

From source file:com.att.aro.ui.view.overviewtab.TraceBenchmarkChartPanel.java

private JFreeChart initializeChart() {

    JFreeChart chart = ChartFactory.createBarChart(
            ResourceBundleHelper.getMessageString("overview.traceoverview.title"), null, null, createDataset(),
            PlotOrientation.HORIZONTAL, false, true, false);
    chart.setBackgroundPaint(this.getBackground());
    chart.getTitle().setFont(AROUIManager.HEADER_FONT);

    this.plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.gray);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

    CategoryAxis valueRangeAxis = plot.getDomainAxis();
    valueRangeAxis.setMaximumCategoryLabelWidthRatio(1.0f);
    valueRangeAxis.setMaximumCategoryLabelLines(2);
    valueRangeAxis.setLabelFont(AROUIManager.LABEL_FONT);
    valueRangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT);

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setLabel(ResourceBundleHelper.getMessageString("analysisresults.percentile"));
    rangeAxis.setRange(0.0, 100.0);// w w  w  .  j a  v a 2s.  com
    rangeAxis.setTickUnit(new NumberTickUnit(10));
    rangeAxis.setLabelFont(AROUIManager.LABEL_FONT);
    rangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT);

    BarRenderer renderer = new StackedBarRenderer();
    renderer.setBasePaint(AROUIManager.CHART_BAR_COLOR);
    renderer.setAutoPopulateSeriesPaint(false);
    renderer.setBaseItemLabelGenerator(new PercentLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelPaint(Color.black);

    // Make second bar in stack invisible
    renderer.setSeriesItemLabelsVisible(1, false);
    renderer.setSeriesPaint(1, new Color(0, 0, 0, 0));

    ItemLabelPosition insideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
            TextAnchor.CENTER_RIGHT);
    renderer.setBasePositiveItemLabelPosition(insideItemlabelposition);

    ItemLabelPosition outsideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
            TextAnchor.CENTER_LEFT);
    renderer.setPositiveItemLabelPositionFallback(outsideItemlabelposition);

    renderer.setBarPainter(new StandardBarPainter());
    renderer.setShadowVisible(false);
    renderer.setMaximumBarWidth(BAR_WIDTH_PERCENT);
    renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {
        @Override
        public String generateToolTip(CategoryDataset arg0, int arg1, int arg2) {
            String traceInfo = "";
            switch (arg2) {
            case TRACE_AVERAGE:
                traceInfo = ResourceBundleHelper.getMessageString("tooltip.traceAnalysis.avg");
                break;
            case TRACE_ENERGY:
                traceInfo = ResourceBundleHelper.getMessageString("tooltip.traceAnalysis.engy");
                break;
            case TRACE_OVERHEAD:
                traceInfo = ResourceBundleHelper.getMessageString("tooltip.traceAnalysis.ovrhd");
                break;
            default:
                break;
            }

            return traceInfo;
        }
    });

    plot.setRenderer(renderer);
    plot.getDomainAxis().setMaximumCategoryLabelLines(2);

    return chart;

}

From source file:org.pf.midea.MainUI.java

private void showConstellationWindow(ConstellationPoint[] _map, String _name) {
    JFrame constellation = new JFrame(" ?? " + _name);
    constellation.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    XYSeriesCollection dots = new XYSeriesCollection();
    XYSeries series = new XYSeries(_name);
    JFreeChart chart = ChartFactory.createScatterPlot("", "I", "Q", dots, PlotOrientation.VERTICAL, false,
            false, false);/*from  ww w  .  j  av a2 s  .  c  om*/
    XYPlot xyPlot = chart.getXYPlot();
    CustomXYToolTipGenerator tooltipsGenerator = new CustomXYToolTipGenerator();
    ArrayList<String> tooltips = new ArrayList<>();
    for (ConstellationPoint ccp : _map) {
        double I = ccp.getI();
        double Q = ccp.getQ();
        series.add(I, Q);
        tooltips.add(ccp.getCode().getStringSequence());
    }
    tooltipsGenerator.addToolTipSeries(tooltips);
    xyPlot.getRenderer().setBaseToolTipGenerator(tooltipsGenerator);
    double maxX = StatisticsTools.round(Math.abs(series.getMaxX()), 3);
    double maxY = StatisticsTools.round(Math.abs(series.getMaxY()), 3);
    double minX = StatisticsTools.round(Math.abs(series.getMinX()), 3);
    double minY = StatisticsTools.round(Math.abs(series.getMinY()), 3);
    if (maxX != 0 || minX != 0) {
        double X = Math.max(minX, maxX);
        xyPlot.getDomainAxis().setRange(-1.1 * X, 1.1 * X);
    } else
        xyPlot.getDomainAxis().setRange(-1, 1);
    if (maxY != 0 || minY != 0) {
        double Y = Math.max(minY, maxY);
        xyPlot.getRangeAxis().setRange(-1.1 * Y, 1.1 * Y);
    } else
        xyPlot.getRangeAxis().setRange(-1, 1);
    dots.addSeries(series);

    xyPlot.setBackgroundPaint(Color.WHITE);
    xyPlot.setDomainGridlinePaint(Color.GRAY);
    xyPlot.setRangeGridlinePaint(Color.GRAY);
    xyPlot.getRenderer().setSeriesPaint(0, Color.BLACK);
    xyPlot.setDomainZeroBaselineVisible(true);
    xyPlot.setRangeZeroBaselineVisible(true);

    ChartPanel chartPanel = new ChartPanel(chart);
    JPanel nestedPanel = new JPanel();
    nestedPanel.add(chartPanel, new CellConstraints());
    constellation.add(nestedPanel);
    constellation.pack();
    constellation.setLocationRelativeTo(null);
    constellation.setResizable(false);
    constellation.setVisible(true);
}

From source file:MyStatsPanel.java

JPanel setFields() {
    getDatabaseInfo();/*from   w  ww.j  a  v  a2 s.c  om*/
    GroupLayout layout;
    JPanel p;

    numGuestsIn = new JLabel("Total guests in house .............................");
    numGuestsIn.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsIn.setForeground(Color.WHITE);
    checkIns = new JLabel("Todays guest check ins ............................");
    checkIns.setForeground(Color.WHITE);
    checkIns.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsOut = new JLabel("Todays guest check outs ...........................");
    numGuestsOut.setFont(new Font("Courier New", Font.PLAIN, 20));
    numGuestsOut.setForeground(Color.WHITE);
    overnights = new JLabel("Total overnight guests ............................");
    overnights.setForeground(Color.WHITE);
    overnights.setFont(new Font("Courier New", Font.PLAIN, 20));

    JLabel n1 = new JLabel(totalGuestsIn);
    n1.setForeground(Color.WHITE);
    n1.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n2 = new JLabel(todaysCheckIns);
    n2.setForeground(Color.WHITE);
    n2.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n3 = new JLabel(todaysCheckOuts);
    n3.setForeground(Color.WHITE);
    n3.setFont(new Font("Courier New", Font.PLAIN, 20));
    JLabel n4 = new JLabel(totalOvernights);
    n4.setForeground(Color.WHITE);
    n4.setFont(new Font("Courier New", Font.PLAIN, 20));

    p = new JPanel();
    p.setBackground(Color.GRAY);

    layout = new GroupLayout(p);
    p.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
    hGroup.addGroup(layout.createParallelGroup().addComponent(numGuestsIn).addComponent(checkIns)
            .addComponent(numGuestsOut).addComponent(overnights));
    hGroup.addGroup(
            layout.createParallelGroup().addComponent(n1).addComponent(n2).addComponent(n3).addComponent(n4));
    layout.setHorizontalGroup(hGroup);

    GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(numGuestsIn).addComponent(n1));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(checkIns).addComponent(n2));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(numGuestsOut).addComponent(n3));
    vGroup.addGroup(layout.createParallelGroup(BASELINE).addComponent(overnights).addComponent(n4));

    layout.setVerticalGroup(vGroup);

    return (p);
}

From source file:com.okmich.hackerday.client.tool.dashboard.ReportItemPanel.java

public void onMouseExit() {
    setBorder(BorderFactory.createLineBorder(Color.GRAY));
}