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.StackedAreaChartTest.java

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

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

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", StackedAreaRenderer.class, categoryPlot.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());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getCategoryPlot().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:net.sf.dynamicreports.test.jasper.chart.XyLineChartTest.java

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

    numberOfPagesTest(1);/*from   w  ww .  j a  va  2 s  .com*/

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYLineAndShapeRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((XYLineAndShapeRenderer) renderer).getBaseShapesVisible());
    Assert.assertFalse("show lines", ((XYLineAndShapeRenderer) renderer).getBaseLinesVisible());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    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.chart3", 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:com.hmsinc.epicenter.webapp.remoting.ForecastingService.java

@Secured("ROLE_USER")
@Transactional(readOnly = true)/* www. ja  v a2s. c o  m*/
@RemoteMethod
public String getSeasonalTrendChart(final AnalysisParametersDTO paramsDTO) {

    final AnalysisParameters params = convertParameters(paramsDTO);

    // 60 day window
    final DateTime windowStart = params.getEndDate().minusDays(59);

    // Set the start date back 1 year + 60 days
    params.setStartDate(windowStart.minusYears(1).minusDays(59));

    final TimeSeriesChart chart = new TimeSeriesChart();

    final TimeSeries ts = queryService.queryForTimeSeries(params, paramsDTO.getAlgorithmName(), null);

    if (ts != null) {

        final TimeSeries forecast = waveletSeasonalTrendForecaster.process(ts.after(windowStart),
                ts.before(windowStart.minusDays(1)), null);
        final TimeSeries known = forecast.before(params.getEndDate());
        final TimeSeries predicted = forecast.after(params.getEndDate().plusDays(1));

        chart.addBand("70% Confidence Prediction", predicted, ResultType.LOWER_BOUND_70,
                ResultType.UPPER_BOUND_70, new Color(0x0072bf), new Color(0x0072bf));
        chart.addBand("80% Confidence Prediction", predicted, ResultType.LOWER_BOUND_80,
                ResultType.UPPER_BOUND_80, new Color(0x0099ff), new Color(0x0099ff));
        chart.addBand("90% Confidence Prediction", predicted, ResultType.LOWER_BOUND_90,
                ResultType.UPPER_BOUND_90, new Color(0x3fb2ff), new Color(0x3fb2ff));
        chart.addBand("95% Confidence Prediction", predicted, ResultType.LOWER_BOUND_95,
                ResultType.UPPER_BOUND_95, new Color(0xbfe5ff), new Color(0xbfe5ff));

        chart.add("Actual Value", known, ChartColor.VALUE.getColor(), LineStyle.DOTTED);
        chart.add("Actual Trend", known, ResultType.TREND, ChartColor.VALUE.getColor(), LineStyle.THICK);

        final DateTime knownFirst = known.first().getTime();
        final DateTime predictedFirst = predicted.first().getTime();

        final Marker marker = new IntervalMarker(
                new Day(knownFirst.getDayOfMonth(), knownFirst.getMonthOfYear(), knownFirst.getYear())
                        .getFirstMillisecond(),
                new Day(predictedFirst.getDayOfMonth(), predictedFirst.getMonthOfYear(),
                        predictedFirst.getYear()).getFirstMillisecond(),
                Color.LIGHT_GRAY, new BasicStroke(2.0f), null, null, 1.0f);
        marker.setAlpha(0.3f);
        chart.getMarkers().add(marker);
        chart.setYLabel(params.getDataRepresentation().getDisplayName());
        chart.setAlwaysScaleFromZero(false);
    }

    return chartService.getChartURL(chart);

}

From source file:OAT.ui.util.UiUtil.java

public static void triggerTextField(JTextField textField, JCheckBox checkBox) {
    if (checkBox.isSelected()) {
        textField.setDisabledTextColor(Color.LIGHT_GRAY);
    }//from  w  ww. ja  va  2 s  .  c o  m

    textField.setEnabled(!checkBox.isSelected());
}

From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeArrowColorTransformer.java

/**
 * Set if the transformer should distinguish each signed connection by a color.
 * @param yes// ww w  .j  ava  2s.com
 */
public void distinguishConnectionByColor(boolean yes) {
    if (yes) {
        enhancerColor_ = new Color(0, 0, 130); //Color.BLACK;
        inhibitoryColor_ = Color.RED;
        dualColor_ = Color.MAGENTA;
        unknownColor_ = Color.LIGHT_GRAY; //new Color(120,120,120);
    } else {
        enhancerColor_ = Color.BLACK;
        inhibitoryColor_ = Color.BLACK;
        dualColor_ = Color.BLACK;
        unknownColor_ = Color.BLACK;
    }
}

From source file:com.prime.location.billing.InvoicedBillingManager.java

/**
 * Print invoice// w w  w .j  av a 2  s .  c o  m
 */
public void printInvoice() {
    try { //catch better your exceptions, this is just an example
        FacesContext context = FacesContext.getCurrentInstance();

        Document pdf = new Document(PageSize.A4, 5f, 5f, 75f, 45f);

        String fileName = "PDFFile";

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PdfWriter writer = PdfWriter.getInstance(pdf, baos);
        TableHeader event = new TableHeader();
        event.setHeader("Header Here");
        writer.setPageEvent(event);

        if (!pdf.isOpen()) {
            pdf.open();
        }

        PdfPCell cell;

        PdfPTable header = new PdfPTable(new float[] { 1, 2, 1 });
        cell = new PdfPCell(new Paragraph("INVOICE",
                FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLDITALIC, Color.BLACK)));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setColspan(3);
        cell.setBorder(Rectangle.NO_BORDER);
        header.addCell(cell);
        header.setTotalWidth(527);
        header.setLockedWidth(true);

        cell = new PdfPCell(new Phrase("Agency: " + selectedAgency.getDescription()));
        cell.setColspan(2);
        cell.setBorder(Rectangle.NO_BORDER);
        header.addCell(cell);

        cell = new PdfPCell(new Phrase("Invoice#: " + selectedInvoice.getId()));
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        header.addCell(cell);

        cell = new PdfPCell(
                new Phrase("Date: " + DateUtility.dateTimeFormat(selectedInvoice.getInvoiceDate())));
        cell.setColspan(3);
        cell.setBorder(Rectangle.NO_BORDER);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        header.addCell(cell);

        pdf.add(header);

        PdfPTable table = new PdfPTable(new float[] { 1, 3, 2, 1 });
        table.setSpacingBefore(15f);

        table.setTotalWidth(527);
        table.setLockedWidth(true);
        //table.setWidths(new int[]{3, 1, 1});

        table.getDefaultCell().setBackgroundColor(Color.LIGHT_GRAY);

        table.addCell("Date");
        table.addCell("Name");
        table.addCell("Service");
        table.addCell("Rate");

        table.getDefaultCell().setBackgroundColor(null);

        cell = new PdfPCell(new Phrase("Total(US$): "));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setColspan(3);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(selectedInvoice.getAmount())));
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(cell);

        // There are three special rows
        table.setHeaderRows(2);
        // One of them is a footer
        table.setFooterRows(1);
        Font f = FontFactory.getFont(FontFactory.HELVETICA, 10);
        //add remaining
        for (AgencyBilling billing : selectedInvoice.getBillings()) {
            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
            table.getDefaultCell().setIndent(2);
            table.getDefaultCell().setFixedHeight(20);

            table.addCell(new Phrase(DateUtility.dateFormat(billing.getBillingDate()), f));
            table.addCell(new Phrase(billing.getPerson().getName(), f));
            table.addCell(new Phrase(billing.getTariff().getTariffType().getDescription(), f));
            cell = new PdfPCell(new Phrase(new DecimalFormat("###,###.###").format(billing.getRate()), f));
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);

            table.addCell(cell);

        }

        pdf.add(table);

        writer.getAcroForm().setNeedAppearances(true);

        //document.add(new Phrase(TEXT));
        //Keep modifying your pdf file (add pages and more)
        pdf.close();

        writePDFToResponse(context.getExternalContext(), baos, fileName);

        context.responseComplete();

    } catch (Exception e) {
        //e.printStackTrace();          
    }
}

From source file:com.itemanalysis.jmetrik.graph.nicc.NonparametricCurvePanel.java

private void createChart(String name, String title, String xLabel, String yLabel, double minScore,
        double maxScore) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    final JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xLabel, // x axis label
            yLabel, // y axis label
            dataset, // data
            chartOrientation, // chart orientation
            showLegend, // include legend
            true, // tooltips
            false // urls
    );//from w w w.j a  va 2  s  . co  m

    if (showLegend) {
        LegendTitle chartTitle = chart.getLegend();
        chartTitle.setPosition(legendPosition);
    }

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);

    //        //can use this code to fix the number of tick marks on the y-axis
    //        NumberFormat myFormatter = new DecimalFormat("#.0");
    //        NumberAxis yaxis = (NumberAxis)plot.getRangeAxis();
    //        yaxis.setTickUnit(new NumberTickUnit(.1, myFormatter));

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

    //        this.addLocalEPSMenuItem(this, panel.getPopupMenu(), chart);//remove this line for public release versions

    chart.setPadding(new RectangleInsets(20.0, 5.0, 20.0, 5.0));
    charts.put(name, chart);

    JPanel subPanel = new JPanel();//additional panel needed to prevent gridlayout from stretching graph
    subPanel.add(panel);
    subPanel.setBackground(Color.WHITE);
    this.add(subPanel);

}

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

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

    numberOfPagesTest(1);/*from   w  w w.  j ava  2s  . c o  m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYLineAndShapeRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((XYLineAndShapeRenderer) renderer).getBaseShapesVisible());
    Assert.assertFalse("show lines", ((XYLineAndShapeRenderer) renderer).getBaseLinesVisible());
    xyChartDataTest(chart, 0, "Column2", new Number[][] { { 1d, 2d }, { 2d, 3d }, { 3d, 4d }, { 4d, 5d } });
    xyChartDataTest(chart, 1, "Column1", new Number[][] { { 2d, 1d }, { 3d, 2d }, { 4d, 3d }, { 5d, 4d } });

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    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.chart3", 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());
}

From source file:hermes.browser.components.WatchTable.java

/**
 * Rows are: Color.RED if an alert level has been breached. Color.ORANGE if
 * an exception has occured gathering the data
 *//*from ww w .  j av a 2 s . c o m*/
public Component prepareRenderer(TableCellRenderer renderer, int y, int x) {
    final Component rval = super.prepareRenderer(renderer, y, x);
    final int originalY = y;
    y = getActualRowAt(y);

    final WatchInfo info = watchModel.getRow(y);
    Component c = null;

    /*
     * I don't understand this bit - unless I get the actual renderer when the
     * component is an ExpandablePanel the first column shades incorrectly.
     */

    if (rval instanceof ExpandablePanel) {
        ExpandablePanel ep = (ExpandablePanel) rval;
        c = ep.getActualRenderer();
    } else {
        c = rval;
    }

    boolean previousInAlert = info.isInAlert();

    if (info != null) {
        if (info.getE() != null) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 255, 153));
            c.setForeground(Color.BLACK);
        } else if (info.getDepthAlert() != 0 && (info.getDepth() > info.getDepthAlert())) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 204, 153));
            c.setForeground(Color.BLACK);
        } else if (info.getAgeAlert() != 0
                && (System.currentTimeMillis() - info.getAgeAlert() > info.getAgeAlert())) {
            info.setInAlert(true);
            c.setBackground(new Color(255, 204, 153));
            c.setForeground(Color.BLACK);
        } else if (originalY % 2 == 0 && !isCellSelected(originalY, x)) {
            info.setInAlert(false);
            c.setBackground(Color.LIGHT_GRAY);
            c.setForeground(Color.BLACK);

        } else if (!isCellSelected(originalY, x)) {
            //
            // If not shaded, match the table's background

            info.setInAlert(false);
            c.setBackground(Color.WHITE);
            c.setForeground(Color.BLACK);
        }
    }

    return rval;
}

From source file:de.citec.csra.allocation.vis.MovingChart.java

public MovingChart(final String title, int past, int future) {

    super(title);

    this.past = past;
    this.future = future;

    this.marker = new ValueMarker(System.currentTimeMillis());
    marker.setPaint(Color.black);

    this.plustime = new TimeSeries("+" + future / 1000 + "s");
    this.dataset.addSeries(this.plustime);
    this.chart = createChart(this.dataset);
    //      this.timer.setInitialDelay(1000);
    this.plustime.addOrUpdate(new Millisecond(new Date(System.currentTimeMillis() - past)), 0);

    //Sets background color of chart
    chart.setBackgroundPaint(Color.LIGHT_GRAY);

    //Created JPanel to show graph on screen
    final JPanel content = new JPanel(new BorderLayout());

    //Created Chartpanel for chart area
    final ChartPanel chartPanel = new ChartPanel(chart);

    //Added chartpanel to main panel
    content.add(chartPanel);/* w w  w. j av a  2  s .c  o  m*/

    //Sets the size of whole window (JPanel)
    chartPanel.setPreferredSize(new java.awt.Dimension(1500, 600));

    //Puts the whole content on a Frame
    setContentPane(content);

    XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) this.chart.getXYPlot().getRendererForDataset(dataset);
    r.setSeriesPaint(0, Color.BLACK);

    this.timer.start();

}