Example usage for java.awt Color LIGHT_GRAY

List of usage examples for java.awt Color LIGHT_GRAY

Introduction

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

Prototype

Color LIGHT_GRAY

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

Click Source Link

Document

The color light gray.

Usage

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);// w  ww. j  ava2s. c om

    JFreeChart chart = getChart("summary.chart1", 0);
    Plot plot = chart.getPlot();
    Assert.assertEquals("renderer", MeterPlot.class, plot.getClass());
    MeterPlot meterPlot = (MeterPlot) plot;
    Assert.assertEquals("value", 15, meterPlot.getDataset().getValue());
    Assert.assertEquals("data range low", 3d, meterPlot.getRange().getLowerBound());
    Assert.assertEquals("data range high", 30d, meterPlot.getRange().getUpperBound());
    Assert.assertEquals("value color", Color.BLUE, meterPlot.getValuePaint());
    Assert.assertEquals("value mask", "15.0", meterPlot.getTickLabelFormat().format(15));
    Assert.assertEquals("value font", new Font("Arial", Font.PLAIN, 10), meterPlot.getValueFont());
    Assert.assertEquals("shape", DialShape.CIRCLE, meterPlot.getDialShape());
    Assert.assertEquals("meter angle", 270, meterPlot.getMeterAngle());
    Assert.assertEquals("units", "units", meterPlot.getUnits());
    Assert.assertEquals("tick interval", 3d, meterPlot.getTickSize());
    Assert.assertEquals("background color", Color.LIGHT_GRAY, meterPlot.getDialBackgroundPaint());
    Assert.assertEquals("needle color", Color.CYAN, meterPlot.getNeedlePaint());
    Assert.assertEquals("tick color", Color.MAGENTA, meterPlot.getTickPaint());
    Assert.assertEquals("tick label font", new Font("Courier New", Font.PLAIN, 10),
            meterPlot.getTickLabelFont());
    Assert.assertEquals("intervals size", 2, meterPlot.getIntervals().size());
    intervalTest((MeterInterval) meterPlot.getIntervals().get(0), "red", new Color(1f, 0f, 0f, 0.8f), 25d, 30d);
    intervalTest((MeterInterval) meterPlot.getIntervals().get(1), "yellow", new Color(1f, 1f, 0f, 0.5f), 20d,
            25d);
}

From source file:com.itemanalysis.jmetrik.graph.scatterplot.ScatterplotPanel.java

public void setGraph() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    PlotOrientation orientation = PlotOrientation.VERTICAL;

    try {// w  w  w. j  av  a2  s  . c  o  m
        chart = ChartFactory.createScatterPlot(title, // chart title
                xlabel, // x axis label
                ylabel, // y axis label
                dataset, // data
                orientation, showLegend, // include legend
                true, // tooltips
                false // urls
        );

        if (subtitle != null && !"".equals(subtitle)) {
            TextTitle subtitle1 = new TextTitle(subtitle);
            chart.addSubtitle(subtitle1);
        }

        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setNoDataMessage("NO DATA");
        plot.setDomainZeroBaselineVisible(false);
        plot.setRangeZeroBaselineVisible(false);
        plot.setBackgroundPaint(Color.WHITE);
        plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
        plot.setDomainGridlinePaint(Color.LIGHT_GRAY);

        ChartPanel panel = new ChartPanel(chart);
        panel.getPopupMenu().addSeparator();
        this.addJpgMenuItem(this, panel.getPopupMenu());
        panel.setPreferredSize(new Dimension(width, height));

        chart.setPadding(new RectangleInsets(20.0, 5.0, 20.0, 5.0));
        this.setBackground(Color.WHITE);
        this.add(panel);

    } catch (IllegalArgumentException ex) {
        logger.fatal(ex.getMessage(), ex);
        this.firePropertyChange("error", "", "Error - Check log for details.");
    }
}

From source file:com.rapidminer.gui.plotter.charts.DeviationChartPlotter.java

private JFreeChart createChart(XYDataset dataset, boolean createLegend) {

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title
            null, // x axis label
            null, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, createLegend, // include legend
            true, // tooltips
            false // urls
    );//from w w  w  .j a v  a  2s . c o m

    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customization...
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

    DeviationRenderer renderer = new DeviationRenderer(true, false);
    Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
    if (dataset.getSeriesCount() == 1) {
        renderer.setSeriesStroke(0, stroke);
        renderer.setSeriesPaint(0, Color.RED);
        renderer.setSeriesFillPaint(0, Color.RED);
    } else {
        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            renderer.setSeriesStroke(i, stroke);
            Color color = getColorProvider()
                    .getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
            renderer.setSeriesPaint(i, color);
            renderer.setSeriesFillPaint(i, color);
        }
    }
    renderer.setAlpha(0.12f);

    plot.setRenderer(renderer);

    ValueAxis valueAxis = plot.getRangeAxis();
    valueAxis.setLabelFont(LABEL_FONT_BOLD);
    valueAxis.setTickLabelFont(LABEL_FONT);

    return chart;
}

From source file:net.sf.dynamicreports.test.jasper.chart.XyAreaChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/* w ww  . ja  v  a2 s.co  m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    XYPlot plot = chart.getXYPlot();
    Assert.assertEquals("renderer", XYAreaRenderer.class, plot.getRenderer().getClass());
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:co.udea.edu.proyectointegrador.gr11.parqueaderoapp.domain.stadistics.graphics.implement.Grafica.java

@Override
public JFreeChart createBarChartToVehicleType(List<TipoVehiculoEstadistica> tipoVehiculos) {
    //Se crea el conjunto de datos para realizar el grafico de barras

    DefaultCategoryDataset dataset = createDataForVehicleType(tipoVehiculos);

    //Se crea el grafico de barras
    JFreeChart chart = ChartFactory.createBarChart3D(TITLE_OF_BAR_CHART, //Titulo del grfico
            DOMAIN_AXIS_LABEL, //Nombre del dominio
            RANGE_AXIS_LABEL, //Nombre del Rango
            dataset, //Conjunto de datos
            PlotOrientation.VERTICAL, //Orientacion del grafico
            true, //Incluye leyendas
            true, false);/*from ww  w  .j  a va  2  s . c  om*/
    //Se pinta el fondo de blanco
    chart.setBackgroundPaint(Color.WHITE);

    //Se pintan el fondo del grafico de gris y las lineas de blanco
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    categoryPlot.setBackgroundPaint(Color.LIGHT_GRAY);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.WHITE);
    categoryPlot.setNoDataMessage(NO_DATA_TO_DISPLAY);

    //Se configura para que solo muestre nmeros enteros
    NumberAxis rangeAxis = (NumberAxis) categoryPlot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    BarRenderer barRenderer = (BarRenderer) categoryPlot.getRenderer();
    barRenderer.setDrawBarOutline(false);

    return chart;
}

From source file:sentimentanalyzer.ChartController.java

public void createAndPopulatePieChart__TESTER(JPanel pnlPieChart) {

    DefaultPieDataset data = new DefaultPieDataset();

    data.setValue(Pos, 0 /*count for 1 */);
    data.setValue(Neu, 0 /*count for 0 */);
    data.setValue(Neg, 0 /*count for -1 */);

    JFreeChart chart = ChartFactory.createPieChart("Sent. Distr. for Testing", data, false, // legend?
            false, // tooltips?
            false // URLs?
    );//  ww w  .ja va2s . c o m
    ChartPanel CP = new ChartPanel(chart);

    PiePlot plot = (PiePlot) chart.getPlot();

    plot.setSectionPaint("Pie chart is not available", Color.LIGHT_GRAY);
    plot.setExplodePercent(Pos, 0.025);
    plot.setExplodePercent(Neg, 0.025);
    plot.setExplodePercent(Neu, 0.025);

    //Customize PieChart to show absolute values and percentages;

    PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
            new DecimalFormat("0"), new DecimalFormat("0.00%"));
    plot.setLabelGenerator(gen);

    TextTitle legendText = new TextTitle("The total number of tweets: ");
    legendText.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendText);

    pnlPieChart.setLayout(new java.awt.BorderLayout());
    pnlPieChart.add(CP, BorderLayout.CENTER);
}

From source file:unikn.dbis.univis.visualization.pivottable.VPivotTable.java

public VPivotTable() {
    setBorder(new EtchedBorder());
    setPreferredSize(new Dimension(1000, 700));
    setLayout(new BorderLayout());
    setBackground(Color.white);/*from w  ww.jav  a 2 s .  c  om*/

    /* *** First Row *** */
    JLabel jlabelMeasure = new JLabel("Measure:");
    jlabelMeasure.setVisible(false);
    JLabel jlabelX = new JLabel("X-Axis Elements:");
    JLabel forVerticalSpace = new JLabel(" ");
    panelFirstRow = new JPanel(new VTableLayout(3, 2, 3, 3));

    dropAreaMeasure = new JTextArea(textInMeasureBox);
    dropAreaMeasure.setToolTipText(textInMeasureBox);
    dropAreaMeasure.setForeground(Color.LIGHT_GRAY);
    dropAreaMeasure.setEditable(false);
    dropAreaMeasure.setPreferredSize(new Dimension(100, 20));
    dropAreaMeasure.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));
    dropAreaMeasure.setVisible(false);

    dropAreaX = new JTextArea(textInXYBox);
    dropAreaX.setToolTipText(textInXYBox);
    dropAreaX.setForeground(Color.LIGHT_GRAY);
    dropAreaX.setEditable(false);
    dropAreaX.setPreferredSize(new Dimension(400, 20));
    dropAreaX.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    panelFirstRow.add(jlabelMeasure);
    panelFirstRow.add(jlabelX);
    panelFirstRow.add(dropAreaMeasure);
    panelFirstRow.add(dropAreaX);
    panelFirstRow.add(forVerticalSpace);
    add(panelFirstRow, BorderLayout.NORTH);

    /* *** Second Row *** */
    JLabel jlabelY1 = new JLabel("Y-Axis");
    JLabel jlabelY2 = new JLabel("Elements:");
    panelSecondRow = new JPanel(new VTableLayout(1, 2, 3, 3));

    dropAreaY = new JTextArea(textInXYBox);
    dropAreaY.setToolTipText(textInXYBox);
    dropAreaY.setForeground(Color.LIGHT_GRAY);
    dropAreaY.setEditable(false);
    dropAreaY.setLineWrap(true);
    dropAreaY.setWrapStyleWord(true);
    dropAreaY.setPreferredSize(new Dimension(100, 400));
    dropAreaY.setBorder(BorderFactory.createEtchedBorder(Color.WHITE, Color.LIGHT_GRAY));

    JPanel panelY = new JPanel(new VTableLayout(3, 1, 1, 1));
    panelY.add(jlabelY1);
    panelY.add(jlabelY2);
    panelY.add(dropAreaY);
    panelSecondRow.add(panelY);
    add(panelSecondRow, BorderLayout.WEST);

    new DropTarget(dropAreaX, DnDConstants.ACTION_COPY_OR_MOVE, this);
    new DropTarget(dropAreaY, DnDConstants.ACTION_COPY_OR_MOVE, this);
}

From source file:Views.GraphView.java

public GraphView(RegularTimePeriod T, String title, double openPrice) {
    graphTitle = title;//from  w  w w. java 2  s  . c o m

    lastValueAsk = openPrice;
    lastValueBid = openPrice;
    lastValueExecuted = openPrice;

    newValueAsk = openPrice;
    newValueBid = openPrice;
    lastexectuednew = openPrice;

    this.BidValuePlot = new TimeSeries("Bid", Millisecond.class);
    this.AskValuePlot = new TimeSeries("Ask", Millisecond.class);
    this.VolumeBidPlot = new TimeSeries("Volume Bid", Millisecond.class);
    this.VolumeAskPlot = new TimeSeries("Volume Ask", Millisecond.class);
    this.ExecutedValuePlot = new TimeSeries("Last Executed", Millisecond.class);
    this.VolumeExecPlot = new TimeSeries("Volume Last Executed", Millisecond.class);

    this.Tdebut = T;
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(BidValuePlot);
    dataset.addSeries(AskValuePlot);
    this.BidValuePlot.add(Tdebut, lastValueBid);
    this.AskValuePlot.add(Tdebut, lastValueAsk);
    dataset2 = new TimeSeriesCollection();
    dataset2.addSeries(VolumeBidPlot);
    dataset2.addSeries(VolumeAskPlot);
    this.VolumeBidPlot.add(Tdebut, lastVolumeBid);
    this.VolumeAskPlot.add(Tdebut, lastVolumeAsk);

    dataset3 = new TimeSeriesCollection();
    dataset3.addSeries(ExecutedValuePlot);
    dataset4 = new TimeSeriesCollection();

    dataset4.addSeries(VolumeExecPlot);
    chart = createChart(dataset);

    //Sets background color of chart
    chart.setBackgroundPaint(Color.LIGHT_GRAY);
    chartPanel = new ChartPanel(chart);

    timer = new Timer(0, this);
    timer.start();

}

From source file:net.sf.dynamicreports.test.jasper.chart.ChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*from   w  ww.  j a  v  a 2s.  c  om*/

    chartCountTest("summary.chart1", 1);
    JFreeChart chart = getChart("summary.chart1", 0);

    TextTitle title = chart.getTitle();
    Assert.assertEquals("title", "title", title.getText());
    Assert.assertEquals("title color", Color.BLUE, title.getPaint());
    Assert.assertEquals("title font", new Font("Arial", Font.BOLD, 10), title.getFont());
    Assert.assertEquals("title position", RectangleEdge.RIGHT, title.getPosition());

    TextTitle subtitle = (TextTitle) chart.getSubtitle(1);
    Assert.assertEquals("subtitle", "subtitle", subtitle.getText());
    Assert.assertEquals("subtitle color", Color.CYAN, subtitle.getPaint());
    Assert.assertEquals("subtitle font", new Font("Arial", Font.PLAIN, 10), subtitle.getFont());

    LegendTitle legend = (LegendTitle) chart.getSubtitle(0);
    Assert.assertEquals("legend color", Color.BLUE, legend.getItemPaint());
    Assert.assertEquals("legend backgroundcolor", Color.LIGHT_GRAY, legend.getBackgroundPaint());
    Assert.assertEquals("legend font", new Font("Courier New", Font.PLAIN, 10), legend.getItemFont());
    Assert.assertEquals("legend position", RectangleEdge.LEFT, legend.getPosition());

    chartCountTest("summary.chart2", 1);
    chart = getChart("summary.chart2", 0);
    Assert.assertNull("legend", chart.getLegend());
    Assert.assertEquals("plot orientation", PlotOrientation.HORIZONTAL,
            chart.getCategoryPlot().getOrientation());
    Assert.assertEquals("plot series colors", Color.BLUE, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.GREEN, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.RED, chart.getPlot().getDrawingSupplier().getNextPaint());
}

From source file:com.att.aro.ui.view.menu.file.BPVideoWarnFailPanel.java

private JTable getTable() {
    if (table == null) {
        model = new VideoPreferenceTableModel(loadPrefs());
        table = new JTable(model);
        table.setGridColor(Color.LIGHT_GRAY);
        table.setFocusable(false);/*from   w ww.j  av a2s .co m*/
        table.setRowSelectionAllowed(false);
        table.setShowGrid(true);
        table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12));
        table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        table.getColumnModel().getColumn(0).setPreferredWidth(225);
        table.getColumnModel().getColumn(1).setPreferredWidth(50);
        table.getColumnModel().getColumn(2).setPreferredWidth(50);
        table.getModel().addTableModelListener(new TableModelListener() {
            @Override
            public void tableChanged(TableModelEvent e) {
                sError = model.getValidationError();
                if (!sError.toString().isEmpty()) {
                    compileResultsField.setVisible(true);
                    compileResultsField.setForeground(Color.red);
                    compileResultsField.setText(String.format("ERROR : %s", sError.toString()));
                } else {
                    compileResultsField.setText("");
                    compileResultsField.setVisible(false);
                }
            }
        });
    } else {
        model.setData(loadPrefs());
        table.setModel(model);
    }
    return table;
}