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:com.rapidminer.gui.plotter.charts.BarChartPlotter.java

@Override
public void updatePlotter() {
    final int categoryCount = prepareData();

    SwingUtilities.invokeLater(new Runnable() {

        @Override/*  w  w w . j  a  v  a  2 s.  c  o  m*/
        public void run() {
            scrollablePlotterPanel.remove(viewScrollBar);
        }
    });

    CategoryDataset usedCategoryDataSet = categoryDataSet;
    if (categoryCount > MAX_CATEGORY_VIEW_COUNT && showScrollbar) {
        if (orientationIndex == ORIENTATION_TYPE_VERTICAL) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    viewScrollBar.setOrientation(Adjustable.HORIZONTAL);
                    scrollablePlotterPanel.add(viewScrollBar, BorderLayout.SOUTH);
                }
            });
        } else {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    viewScrollBar.setOrientation(Adjustable.VERTICAL);
                    scrollablePlotterPanel.add(viewScrollBar, BorderLayout.EAST);
                }
            });
        }

        this.slidingCategoryDataSet = new SlidingCategoryDataset(categoryDataSet, 0, MAX_CATEGORY_VIEW_COUNT);
        viewScrollBar.setMaximum(categoryCount);
        viewScrollBar.setValue(0);

        usedCategoryDataSet = this.slidingCategoryDataSet;
    } else {
        this.slidingCategoryDataSet = null;
    }

    if (categoryCount <= MAX_CATEGORIES) {
        JFreeChart chart = ChartFactory.createBarChart(null, // chart title
                null, // domain axis label
                null, // range axis label
                usedCategoryDataSet, // data
                orientationIndex == ORIENTATION_TYPE_VERTICAL ? PlotOrientation.VERTICAL
                        : PlotOrientation.HORIZONTAL, // orientation
                false, // include legend if group by column is set
                true, // tooltips
                false // URLs
        );

        // set the background color for the chart...
        chart.setBackgroundPaint(Color.WHITE);
        chart.getPlot().setBackgroundPaint(Color.WHITE);

        CategoryPlot plot = chart.getCategoryPlot();
        plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
        plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

        CategoryAxis domainAxis = plot.getDomainAxis();
        domainAxis.setLabelFont(LABEL_FONT_BOLD);
        domainAxis.setTickLabelFont(LABEL_FONT);
        String domainName = groupByColumn >= 0 ? dataTable.getColumnName(groupByColumn) : null;
        domainAxis.setLabel(domainName);

        // rotate labels
        if (isLabelRotating()) {
            plot.getDomainAxis().setTickLabelsVisible(true);
            plot.getDomainAxis().setCategoryLabelPositions(
                    CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
        }

        // set the range axis to display integers only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setLabelFont(LABEL_FONT_BOLD);
        rangeAxis.setTickLabelFont(LABEL_FONT);
        String rangeName = valueColumn >= 0 ? dataTable.getColumnName(valueColumn) : null;
        rangeAxis.setLabel(rangeName);

        // bar renderer
        double[] colorValues = null;
        if (groupByColumn >= 0 && this.dataTable.isNominal(groupByColumn)) {
            colorValues = new double[this.dataTable.getNumberOfValues(groupByColumn)];
        } else {
            colorValues = new double[categoryDataSet.getColumnCount()];
        }
        for (int i = 0; i < colorValues.length; i++) {
            colorValues[i] = i;
        }

        BarRenderer renderer = new ColorizedBarRenderer(colorValues);
        renderer.setBarPainter(new RapidBarPainter());
        renderer.setDrawBarOutline(true);
        int size = categoryDataSet.getRowCount();
        if (size > 1) {
            for (int i = 0; i < size; i++) {
                renderer.setSeriesPaint(i, getColorProvider(true).getPointColor(i / (double) (size - 1)));
            }
        }
        plot.setRenderer(renderer);

        // legend settings
        LegendTitle legend = chart.getLegend();
        if (legend != null) {
            legend.setPosition(RectangleEdge.TOP);
            legend.setFrame(BlockBorder.NONE);
            legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
            legend.setItemFont(LABEL_FONT);
        }

        if (panel != null) {
            panel.setChart(chart);
        } else {
            panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN);
            scrollablePlotterPanel.add(panel, BorderLayout.CENTER);
            final ChartPanelShiftController controller = new ChartPanelShiftController(panel);
            panel.addMouseListener(controller);
            panel.addMouseMotionListener(controller);
        }

        // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
        panel.getChartRenderingInfo().setEntityCollection(null);
    } else {
        // LogService.getGlobal().logNote("Too many columns (" + categoryCount +
        // "), this chart is only able to plot up to " + MAX_CATEGORIES +
        // " different categories.");
        LogService.getRoot().log(Level.INFO,
                "com.rapidminer.gui.plotter.charts.BarChartPlotter.too_many_columns",
                new Object[] { categoryCount, MAX_CATEGORIES });
    }
}

From source file:edu.illinois.ncsa.datawolf.service.ExecutionsResource.java

private JFreeChart createChart(String xVariable, String yVariable, XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createXYLineChart("Convergence Graph", xVariable, yVariable, dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.WHITE);
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return chart;
}

From source file:org.mwc.cmap.xyplot.views.XYPlotView.java

@SuppressWarnings("deprecation")
private void fillThePlot(final String title, final String units, final formattingOperation theFormatter,
        final AbstractSeriesDataset dataset) {

    final StepControl _theStepper = null;

    // the working variables we rely on later
    _thePlotArea = null;/*  www.j a  v  a  2 s .c  o  m*/
    ValueAxis xAxis = null;

    XYToolTipGenerator tooltipGenerator = null;

    // the y axis is common to hi & lo res. Format it here
    final NumberAxis yAxis = new NumberAxis(units);
    final Font tickFont = new Font("SansSerif", Font.PLAIN, 14);
    Font labelFont = new Font("SansSerif", Font.PLAIN, 16);
    yAxis.setLabelFont(labelFont);
    yAxis.setTickLabelFont(tickFont);

    // hmm, see if we are in hi-res mode. If we are, don't use a formatted
    // y-axis, just use the plain long microseconds
    // value
    if (HiResDate.inHiResProcessingMode()) {

        // final SimpleDateFormat _secFormat = new SimpleDateFormat("ss");

        // ok, simple enough for us...
        final NumberAxis nAxis = new NumberAxis("time (secs.micros)") {
            /**
             * 
             */
            private static final long serialVersionUID = 1L;

            // public String getTickLabel(double currentTickValue)
            // {
            // long time = (long) currentTickValue;
            // Date dtg = new HiResDate(0, time).getDate();
            // String res = _secFormat.format(dtg) + "."
            // + DebriefFormatDateTime.formatMicros(new HiResDate(0, time));
            // return res;
            // }
        };
        nAxis.setAutoRangeIncludesZero(false);
        xAxis = nAxis;

        // just show the raw data values
        tooltipGenerator = new StandardXYToolTipGenerator();
    } else {
        // create a date-formatting axis
        final DateAxis dAxis = new RelativeDateAxis();
        dAxis.setStandardTickUnits(DateAxisEditor.createStandardDateTickUnitsAsTickUnits());
        xAxis = dAxis;

        // also create the date-knowledgable tooltip writer
        tooltipGenerator = new DatedToolTipGenerator();
    }

    xAxis.setTickLabelFont(tickFont);
    xAxis.setLabelFont(labelFont);

    // create the special stepper plot
    final ColourStandardXYItemRenderer theRenderer = new ColourStandardXYItemRenderer(tooltipGenerator, null,
            null);
    _thePlot = new StepperXYPlot(null, (RelativeDateAxis) xAxis, yAxis, _theStepper, theRenderer);
    theRenderer.setPlot(_thePlot);
    theRenderer.setStroke(new BasicStroke(3.0f));

    _thePlot.setRangeGridlineStroke(new BasicStroke(1f));
    _thePlot.setDomainGridlineStroke(new BasicStroke(1f));
    _thePlot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    xAxis.setTickMarkStroke(new BasicStroke(1f));
    yAxis.setTickMarkStroke(new BasicStroke(1f));
    _thePlot.setOutlineStroke(new BasicStroke(2f));

    // loop through the datasets, setting the color of each series to the first
    // color in that series
    if (dataset instanceof TimeSeriesCollection) {
        Color seriesCol = null;
        final TimeSeriesCollection tsc = (TimeSeriesCollection) dataset;
        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            final TimeSeries ts = tsc.getSeries(i);
            if (ts.getItemCount() > 0) {
                final TimeSeriesDataItem dataItem = ts.getDataItem(0);
                if (dataItem instanceof ColouredDataItem) {
                    final ColouredDataItem cd = (ColouredDataItem) dataItem;
                    seriesCol = cd.getColor();
                    _thePlot.getRenderer().setSeriesPaint(i, seriesCol);
                }
            }
        }
    }

    // apply any formatting for this choice
    if (theFormatter != null) {
        theFormatter.format(_thePlot);
    }

    boolean createLegend = dataset.getSeriesCount() > 1;
    _thePlotArea = new NewFormattedJFreeChart(title, null, _thePlot, createLegend, _theStepper);

    // set the color of the area surrounding the plot
    // - naah, don't bother. leave it in the application background color.
    _thePlotArea.setBackgroundPaint(Color.white);

    // ////////////////////////////////////////////////
    // put the holder into one of our special items
    // ////////////////////////////////////////////////
    _chartInPanel = new StepperChartPanel(_thePlotArea, true, _theStepper);

    // ok - we need to fire time-changes to the chart
    setupFiringChangesToChart();

    // format the chart
    _chartInPanel.setName(title);
    _chartInPanel.setMouseZoomable(true, true);

    // and insert into the composite
    _plotControl.setChart(_thePlotArea);

    // get the cross hairs ready
    _thePlot.setDomainCrosshairVisible(true);
    _thePlot.setRangeCrosshairVisible(true);
    _thePlot.setDomainCrosshairPaint(Color.GRAY);
    _thePlot.setRangeCrosshairPaint(Color.GRAY);
    _thePlot.setDomainCrosshairStroke(new BasicStroke(2));
    _thePlot.setRangeCrosshairStroke(new BasicStroke(2));

    // and the plot object to display the cross hair value
    _crosshairValueText = new XYTextAnnotation(" ", 0, 0);
    _crosshairValueText.setTextAnchor(TextAnchor.TOP_LEFT);
    _crosshairValueText.setFont(new Font("SansSerif", Font.BOLD, 15));
    _crosshairValueText.setPaint(Color.black);
    _crosshairValueText.setBackgroundPaint(Color.white);
    _thePlot.addAnnotation(_crosshairValueText);

    _thePlotArea.addChangeListener(new ChartChangeListener() {

        @Override
        public void chartChanged(ChartChangeEvent event) {
            if (_showSymbols.isShowSymbols() != _thePlotArea.isShowSymbols()) {
                _showSymbols.updateAction();
            }
        }
    });
    _showSymbols.updateAction();
    _thePlotArea.addProgressListener(new ChartProgressListener() {
        public void chartProgress(final ChartProgressEvent cpe) {
            if (cpe.getType() != ChartProgressEvent.DRAWING_FINISHED)
                return;

            // double-check our label is still in the right place
            final double xVal = _thePlot.getRangeAxis().getUpperBound();
            final double yVal = _thePlot.getDomainAxis().getLowerBound();

            boolean annotChanged = false;
            if (_crosshairValueText.getX() != yVal) {
                _crosshairValueText.setX(yVal);
                annotChanged = true;
            }
            if (_crosshairValueText.getY() != xVal) {
                _crosshairValueText.setY(xVal);
                annotChanged = true;
            }

            // and write the text
            final String numA = MWC.Utilities.TextFormatting.GeneralFormat
                    .formatOneDecimalPlace(_thePlot.getRangeCrosshairValue());
            final Date newDate = new Date((long) _thePlot.getDomainCrosshairValue());
            final SimpleDateFormat _df = new SimpleDateFormat("HHmm:ss");
            _df.setTimeZone(TimeZone.getTimeZone("GMT"));
            final String dateVal = _df.format(newDate);
            final String theMessage = " [" + dateVal + "," + numA + "]";
            if (!theMessage.equals(_crosshairValueText.getText())) {
                _crosshairValueText.setText(theMessage);
                annotChanged = true;
            }

            if (annotChanged) {
                _plotControl.getChart().setNotify(true);
            }
        }
    });

    // ////////////////////////////////////////////////////
    // put the time series into the plot
    // ////////////////////////////////////////////////////
    _thePlot.setDataset((XYDataset) dataset);
}

From source file:uk.ac.leeds.ccg.andyt.generic.visualisation.charts.Generic_ScatterPlotAndLinearRegression.java

/**
 * @param regressionParameters regressionParameters[0] is the y axis
 * intercept; regressionParameters[1] is the change in y relative to x
 * (gradient or slope); regressionParameters[2] is the rank correlation
 * coefficient (RSquare); regressionParameters[3] is data[0].length.
 *//*w  w  w  .  j  av a 2  s  . c  o  m*/
protected void drawLegend(double[] regressionParameters) {
    //        int[] result = new int[3];

    int newLegendWidth = 0;
    int newLegendHeight = 0;
    //        int legendExtraWidthLeft = 0;
    //        int legendExtraWidthRight = 0;
    int textHeight = getTextHeight();
    int legendExtraHeightBottom = textHeight;

    int legendStartRow = getDataEndRow() + getxAxisHeight();
    //        int legendStartRow = this.dataEndRow + this.xAxisHeight / 2;
    int symbolRow;
    int row;
    int symbolCol;
    int col;
    int symbolWidth = 10;
    // Legend Title
    setPaint(Color.DARK_GRAY);
    int legendItemWidth = 0;

    String text = "Legend";
    int textWidth = getTextWidth(text);
    newLegendHeight += textHeight;
    row = legendStartRow + newLegendHeight;
    //col = dataStartCol - yAxisWidth;
    col = textHeight;
    legendItemWidth += textWidth;
    newLegendWidth = Math.max(newLegendWidth, legendItemWidth);
    drawString(text, col, row);
    Point2D.Double point = new Point2D.Double();

    // Point marker
    legendItemWidth = 0;
    newLegendHeight += textHeight;
    symbolRow = legendStartRow + newLegendHeight;
    legendItemWidth += symbolWidth;
    symbolCol = col + symbolWidth / 2;
    point.setLocation(symbolCol, symbolRow);
    setPaint(Color.DARK_GRAY);
    draw(point);
    row += ((3 * textHeight) / 2) - 2;
    newLegendHeight += (textHeight / 2) - 2;
    col += symbolWidth + 4;
    setPaint(Color.GRAY);
    text = "Data Point";
    textWidth = getTextWidth(text);
    legendItemWidth += textWidth;
    newLegendWidth = Math.max(newLegendWidth, legendItemWidth);
    drawString(text, col, row);
    // Y = X line
    setPaint(Color.LIGHT_GRAY);
    //int itemSymbolWidth = (symbolCol + symbolWidth / 2) - (symbolCol - symbolWidth / 2);
    //legendItemWidth = itemSymbolWidth;        
    //legendItemWidth = symbolWidth + 4;
    symbolRow += textHeight;
    draw(new Line2D.Double(symbolCol - symbolWidth / 2, (symbolRow + textHeight / 2) - 2,
            symbolCol + symbolWidth / 2, (symbolRow - textHeight / 2) + 2));
    setPaint(Color.GRAY);
    row += textHeight;
    text = "Y = X";
    textWidth = getTextWidth(text);
    drawString(text, col, row);
    legendItemWidth = textWidth;
    newLegendWidth = Math.max(newLegendWidth, legendItemWidth);
    newLegendHeight += textHeight + 4;

    // Regression line
    setPaint(Color.DARK_GRAY);
    legendItemWidth = symbolWidth + 4;
    symbolRow += textHeight;
    row += textHeight;
    draw(new Line2D.Double(symbolCol - symbolWidth / 2, (symbolRow + textHeight / 2) - 2,
            symbolCol + symbolWidth / 2, (symbolRow - textHeight / 2) + 2));
    setPaint(Color.GRAY);
    // Y = mX + c
    // generalise m
    int scale = 4;
    BigDecimal m;
    if (Double.isNaN(regressionParameters[1])) {
        m = BigDecimal.ZERO;
    } else {
        m = BigDecimal.valueOf(regressionParameters[1]);
    }
    RoundingMode roundingMode = getRoundingMode();
    m = m.setScale(scale, roundingMode);
    m = m.stripTrailingZeros();
    //        m = Generic_BigDecimal.roundStrippingTrailingZeros(
    //                m, 
    //                decimalPlacePrecision,
    //                _RoundingMode);
    BigDecimal c;
    if (Double.isNaN(regressionParameters[0])) {
        c = BigDecimal.ZERO;
    } else {
        c = BigDecimal.valueOf(regressionParameters[0]);
    }
    c = c.setScale(scale, roundingMode);
    c = c.stripTrailingZeros();
    BigDecimal rsquare;
    if (Double.isNaN(regressionParameters[2])) {
        rsquare = BigDecimal.ZERO;
    } else {
        rsquare = BigDecimal.valueOf(regressionParameters[2]);
    }
    rsquare = rsquare.setScale(3, roundingMode);
    rsquare = rsquare.stripTrailingZeros();
    String equation;
    if (c.compareTo(BigDecimal.ZERO) != -1) {
        equation = "Y = (" + m + " * X) + " + c + "";
    } else {
        equation = "Y = (" + m + " * X) - " + c.negate() + "";
    }
    drawString(equation, col, row);
    textWidth = getTextWidth(equation);
    legendItemWidth += textWidth;
    newLegendWidth = Math.max(newLegendWidth, legendItemWidth);
    newLegendHeight += textHeight;

    // Rsquare component
    String rsquare_String = "RSquare = " + rsquare;
    textWidth = getTextWidth(rsquare_String);
    legendItemWidth = textWidth;
    row += textHeight;
    drawString(rsquare_String, col, row);
    //setLegendHeight(row - legendStartRow);
    newLegendWidth = Math.max(newLegendWidth, legendItemWidth);
    newLegendHeight += (2 * textHeight);

    int imageWidth = getImageWidth();
    int dataWidth = getDataWidth();
    int extraWidthLeft = getExtraWidthLeft();
    if (newLegendWidth > getLegendWidth()) {
        //int diff = newLegendWidth - legendWidth;
        if (newLegendWidth > imageWidth) {
            setImageWidth(newLegendWidth);
            setExtraWidthRight(newLegendWidth - extraWidthLeft - dataWidth);
        }
        setLegendWidth(newLegendWidth);
    }
    int extraHeightBottom = getExtraHeightBottom();
    if (newLegendHeight > getLegendHeight()) {
        //int diff = newLegendHeight - legendHeight;
        //int heightForLegend = legendStartRow - dataStartRow + newLegendHeight;
        int newExtraHeightBottom = newLegendHeight + getxAxisHeight();
        if (newExtraHeightBottom > extraHeightBottom) {
            int diff2 = newExtraHeightBottom - extraHeightBottom;
            setExtraHeightBottom(newExtraHeightBottom);
            setImageHeight(getImageHeight() + diff2);
        }
        setLegendHeight(newLegendHeight);
    }
    //        result[0] = legendExtraWidthLeft;
    //        result[1] = legendExtraWidthRight;
    //        result[2] = legendExtraHeightBottom;

    //        return result;

}

From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUIElement.java

/** Builds and lays out the UI. */
private void buildGUI() {
    layoutEntries(false);/*from w w  w. jav  a 2s .c  o  m*/
    JScrollPane pane = new JScrollPane(entries);
    pane.setOpaque(false);
    pane.setBorder(new LineBorder(Color.LIGHT_GRAY));
    setLayout(new BorderLayout(0, 0));
    add(buildHeader(), BorderLayout.NORTH);
    add(pane, BorderLayout.CENTER);
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.ChannelAcquisitionComponent.java

/**
 * Sets the plane info for the specified channel.
 * /*from w ww.  j a  v  a2s  .c  o  m*/
 * @param index  The index of the channel.
 */
void setPlaneInfo(int index) {
    if (channel.getIndex() != index)
        return;
    Collection result = model.getChannelPlaneInfo(index);
    String[][] values = new String[2][result.size() + 1];
    String[] names = new String[result.size() + 1];
    int i = 0;
    Iterator j = result.iterator();
    PlaneInfo info;
    Map<String, Object> details;
    List<String> notSet;
    names[0] = "t";
    values[0][i] = "Delta T";
    values[1][i] = "Exposure";
    i++;
    while (j.hasNext()) {
        info = (PlaneInfo) j.next();
        details = EditorUtil.transformPlaneInfo(info);
        notSet = (List<String>) details.get(EditorUtil.NOT_SET);
        if (!notSet.contains(EditorUtil.DELTA_T)) {
            if (details.get(EditorUtil.DELTA_T) instanceof BigResult) {
                MetadataViewerAgent.logBigResultExeption(this, details.get(EditorUtil.DELTA_T),
                        EditorUtil.DELTA_T);
                values[0][i] = "N/A";
            } else {
                double tInS = ((Double) details.get(EditorUtil.DELTA_T));
                values[0][i] = getReadableTime(tInS);
            }
        } else
            values[0][i] = "--";

        if (!notSet.contains(EditorUtil.EXPOSURE_TIME)) {
            if (details.get(EditorUtil.EXPOSURE_TIME) instanceof BigResult) {
                MetadataViewerAgent.logBigResultExeption(this, details.get(EditorUtil.EXPOSURE_TIME),
                        EditorUtil.EXPOSURE_TIME);
                values[1][i] = "N/A";
            } else {
                double tInS = ((Double) details.get(EditorUtil.EXPOSURE_TIME));
                values[1][i] = getReadableTime(tInS);
            }
        } else
            values[1][i] = "--";
        names[i] = "t=" + i;
        i++;
    }
    if (i > 1) {
        JTable table = new JTable(values, names);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setShowGrid(true);
        table.setGridColor(Color.LIGHT_GRAY);
        JScrollPane pane = new JScrollPane(table);
        Dimension d = table.getPreferredSize();
        Dimension de = exposureTask.getPreferredSize();
        pane.setPreferredSize(new Dimension(de.width - 10, 4 * d.height));
        exposureTask.add(pane);
        exposureTask.setVisible(true);
    } else {
        exposureTask.setVisible(false);
    }
}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

private void addSummaryOfNeedsRow(PdfPTable summaryOfNeedsTable, String needType, String needTypeKey,
        List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList) {
    //row3/*from w w w .  j a  va2  s.c o m*/
    PdfPCell c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase(needType, new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
    summaryOfNeedsTable.addCell(c2);

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }

}

From source file:com.decypher.threadsclient.ChartProvider.java

/**
 * ****** End of Dashboard Charts **********
 *///from w  w w. j  av  a2 s.c  om
public static JPanelChart addChart(JFreeChart chart, String title) {
    chart.getPlot().setBackgroundPaint(Color.LIGHT_GRAY);
    chart.setBackgroundPaint(SystemColor.control);
    ChartPanel cpnl = new ChartPanel(chart);
    JPanelChart pnl = new JPanelChart(chart);
    pnl.setLayout(new BorderLayout());
    pnl.setPreferredSize(new Dimension(getMaxWidth(), maxHeight));
    pnl.add(cpnl, BorderLayout.CENTER);
    pnl.setName(title);
    return pnl;
}

From source file:org.efaps.esjp.ui.print.Table_Base.java

/**
 * Get the Style for the different Sections.
 *
 * @param _parameter Parameter as passed by the eFaps API
 * @param _detail Section//from   w  w  w.  j  a v  a 2s.  c  om
 * @return Style for Dynamic JAsper
 * @throws EFapsException on error
 */
protected StyleBuilder getStyle(final Parameter _parameter, final Section _detail) throws EFapsException {
    final StyleBuilder ret;
    switch (_detail) {
    case TITLE:
        ret = DynamicReports.stl.style().setBold(true);
        break;
    case COLUMN:
        ret = DynamicReports.stl.style().setFontSize(8).setBorder(Styles.penThin()).setPadding(2);
        break;
    case COLUMNHEADER:
        ret = DynamicReports.stl.style().setFont(Styles.font().bold().setFontSize(8))
                .setBorder(Styles.penThin())
                .setTextAlignment(HorizontalTextAlignment.CENTER, VerticalTextAlignment.MIDDLE)
                .setBackgroundColor(Color.LIGHT_GRAY);
        break;
    default:
        ret = DynamicReports.stl.style().setFont(Styles.font().setFontSize(8)).setBorder(Styles.pen1Point());
        break;
    }
    return ret;
}