Example usage for java.awt Color getGreen

List of usage examples for java.awt Color getGreen

Introduction

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

Prototype

public int getGreen() 

Source Link

Document

Returns the green component in the range 0-255 in the default sRGB space.

Usage

From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java

private void showEnvelope(final int[] arr, final List<XYAnnotation> aaa) throws Exception {
    final Color cc = ColorHelper.getColorForAString(attr.name());
    final Color newcc = new Color(cc.getRed(), cc.getGreen(), cc.getBlue(), cc.getAlpha() / 4).brighter();

    final Map<Double, Double> minMap = new HashMap<Double, Double>();
    final Map<Double, Double> maxMap = new HashMap<Double, Double>();

    for (final Algo aall : Algo.values()) {
        Instances filteredDs2 = WekaDataProcessingUtil.buildFilteredByAttributesDataSet(dataSet, arr);

        filteredDs2 = WekaDataProcessingUtil.buildFilteredDataSet(filteredDs2, 0,
                filteredDs2.numAttributes() - 1, Math.max(0, this.position - this.valuesBeforeAndAfter),
                Math.min(this.position + this.gapsize + this.valuesBeforeAndAfter,
                        filteredDs2.numInstances() - 1));

        final GapFiller gp = GapFillerFactory.getGapFiller(aall);

        final Instances completedds2 = gp.fillGaps(filteredDs2);
        final Instances diff2 = WekaTimeSeriesUtil.buildDiff(filteredDs2, completedds2);

        //final double mae2=this.gapFiller.evaluateMeanAbsoluteError(filteredDs2,valuesBeforeAndAfterForMAE);

        final Instances decomposition2 = WekaTimeSeriesUtil.buildMergedDataSet(filteredDs2, diff2);
        final Attribute diffAttribute2 = decomposition2.attribute(attr.name() + "_diff");

        final Attribute timestampDiffAttribute2 = decomposition2
                .attribute(WekaDataStatsUtil.getFirstDateAttributeIdx(decomposition2));

        for (int i = 1; i < decomposition2.numInstances() - 1; i++) {
            if (!decomposition2.instance(i).isMissing(diffAttribute2)/*&&i%10==0*/) {
                final double d = decomposition2.instance(i).value(diffAttribute2);
                final double timestamp = decomposition2.instance(i).value(timestampDiffAttribute2);

                aaa.add(new XYDrawableAnnotation(timestamp, d, 1, 1, new AnnotationDrawer(newcc)));

                if (!minMap.containsKey(timestamp) || minMap.get(timestamp) > d)
                    minMap.put(timestamp, d);
                if (!maxMap.containsKey(timestamp) || maxMap.get(timestamp) < d)
                    maxMap.put(timestamp, d);
            }/*from   ww  w  . ja  va2 s  .  co  m*/
        }
    }

    for (final Map.Entry<Double, Double> entry : minMap.entrySet()) {
        final Double timestamp = entry.getKey();
        final Double min = minMap.get(timestamp);
        final Double max = maxMap.get(timestamp);
        if (min > max)
            throw new IllegalStateException("min>max -> " + min + ">" + max);
        else if (max > min) {
            final double step = (max - min) / 20d;
            for (double dd = min; dd <= max; dd += step) {
                aaa.add(new XYDrawableAnnotation(timestamp, dd, 1, 1, new AnnotationDrawer(newcc)));
            }
        }
    }

    System.out.println("done");
}

From source file:org.kurento.test.base.BrowserTest.java

public String ocr(BufferedImage imgBuff) {
    String parsedOut = null;//from   w w w . j av  a 2 s  .com

    try {
        // Color image to pure black and white
        for (int x = 0; x < imgBuff.getWidth(); x++) {
            for (int y = 0; y < imgBuff.getHeight(); y++) {
                Color color = new Color(imgBuff.getRGB(x, y));
                int red = color.getRed();
                int green = color.getBlue();
                int blue = color.getGreen();
                if (red + green + blue > OCR_COLOR_THRESHOLD) {
                    red = green = blue = 0; // Black
                } else {
                    red = green = blue = 255; // White
                }
                Color col = new Color(red, green, blue);
                imgBuff.setRGB(x, y, col.getRGB());
            }
        }

        // OCR recognition
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(imgBuff, "png", baos);
        byte[] imageBytes = baos.toByteArray();

        TessBaseAPI api = new TessBaseAPI();
        api.Init(null, "eng");
        ByteBuffer imgBB = ByteBuffer.wrap(imageBytes);

        PIX image = pixReadMem(imgBB, imageBytes.length);
        api.SetImage(image);

        // Get OCR result
        BytePointer outText = api.GetUTF8Text();

        // Destroy used object and release memory
        api.End();
        api.close();
        outText.deallocate();
        pixDestroy(image);

        // OCR corrections
        parsedOut = outText.getString().replaceAll("l", "1").replaceAll("Z", "2").replaceAll("O", "0")
                .replaceAll("B", "8").replaceAll("G", "6").replaceAll("S", "8").replaceAll("'", "")
                .replaceAll("", "").replaceAll("\\.", ":").replaceAll("E", "8").replaceAll("o", "0")
                .replaceAll("", "0").replaceAll("?", "6").replaceAll("", "5").replaceAll("I", "1")
                .replaceAll("T", "7").replaceAll("", "").replaceAll("U", "0").replaceAll("D", "0");
        if (parsedOut.length() > 7) {
            parsedOut = parsedOut.substring(0, 7) + ":" + parsedOut.substring(8, parsedOut.length());
        }
        parsedOut = parsedOut.replaceAll("::", ":");

        // Remove last part (number of frames)
        int iSpace = parsedOut.lastIndexOf(" ");
        if (iSpace != -1) {
            parsedOut = parsedOut.substring(0, iSpace);
        }
    } catch (IOException e) {
        log.warn("IOException in OCR", e);
    }
    return parsedOut;
}

From source file:com.siteview.ecc.report.xls.JRXlsExporter.java

/**
 *
 *//*w  w  w.  j a v a2 s  .com*/
protected static HSSFColor getNearestColor(Color awtColor) {
    HSSFColor color = (HSSFColor) hssfColorsCache.get(awtColor);
    if (color == null) {
        Map triplets = HSSFColor.getTripletHash();
        if (triplets != null) {
            Collection keys = triplets.keySet();
            if (keys != null && keys.size() > 0) {
                Object key = null;
                HSSFColor crtColor = null;
                short[] rgb = null;
                int diff = 0;
                int minDiff = 999;
                for (Iterator it = keys.iterator(); it.hasNext();) {
                    key = it.next();

                    crtColor = (HSSFColor) triplets.get(key);
                    rgb = crtColor.getTriplet();

                    diff = Math.abs(rgb[0] - awtColor.getRed()) + Math.abs(rgb[1] - awtColor.getGreen())
                            + Math.abs(rgb[2] - awtColor.getBlue());

                    if (diff < minDiff) {
                        minDiff = diff;
                        color = crtColor;
                    }
                }
            }
        }

        hssfColorsCache.put(awtColor, color);
    }

    return color;
}

From source file:be.ugent.maf.cellmissy.gui.view.renderer.jfreechart.ExtendedBoxAndWhiskerRenderer.java

/**
 * Draws the visual representation of a single data item when the plot has a
 * vertical orientation./* w  ww .  java 2s  .  c om*/
 *
 * @param g2 the graphics device.
 * @param state the renderer state.
 * @param dataArea the area within which the plot is being drawn.
 * @param plot the plot (can be used to obtain standard color information
 * etc).
 * @param domainAxis the domain axis.
 * @param rangeAxis the range axis.
 * @param dataset the dataset.
 * @param row the row index (zero-based).
 * @param column the column index (zero-based).
 */
@Override
public void drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
        CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column) {

    // do nothing if item is not visible
    if (!getItemVisible(row, column)) {
        return;
    }

    //Determine the catgory start and end.
    BoxAndWhiskerCategoryDataset bawDataset = (BoxAndWhiskerCategoryDataset) dataset;

    double categoryEnd = domainAxis.getCategoryEnd(column, getColumnCount(), dataArea,
            plot.getDomainAxisEdge());
    double categoryStart = domainAxis.getCategoryStart(column, getColumnCount(), dataArea,
            plot.getDomainAxisEdge());
    double categoryWidth = categoryEnd - categoryStart;

    domainAxis.setCategoryMargin(0.25);

    rangeAxis.setUpperMargin(0.3);
    rangeAxis.setLowerMargin(0.3);

    double xx = categoryStart;
    int seriesCount = getRowCount();
    int categoryCount = getColumnCount();

    if (seriesCount > 1) {
        double seriesGap = dataArea.getWidth() * getItemMargin() / (categoryCount * (seriesCount - 1));
        double usedWidth = (state.getBarWidth() * seriesCount) + (seriesGap * (seriesCount - 1));
        // offset the start of the boxes if the total width used is smaller
        // than the category width
        double offset = (categoryWidth - usedWidth) / 2;
        xx = xx + offset + (row * (state.getBarWidth() + seriesGap));
    } else {
        // offset the start of the box if the box width is smaller than the category width
        double offset = (categoryWidth - state.getBarWidth()) / 2;
        xx = xx + offset;
    }
    double xxmid = xx + state.getBarWidth() / 2.0;

    //Draw the box.
    Paint p = getItemPaint(row, column);
    if (p != null) {
        g2.setPaint(p);
    }
    Stroke s = getItemStroke(row, column);
    g2.setStroke(s);

    RectangleEdge location = plot.getRangeAxisEdge();
    Shape box = null;

    Number yQ1 = bawDataset.getQ1Value(row, column);
    Number yQ3 = bawDataset.getQ3Value(row, column);
    Number yMax = bawDataset.getMaxRegularValue(row, column);
    Number yMin = bawDataset.getMinRegularValue(row, column);

    if (yQ1 != null && yQ3 != null && yMax != null && yMin != null) {

        double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea, location);
        double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea, location);
        double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(), dataArea, location);
        double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(), dataArea, location);

        // set the paint according to the right technical replicate
        int length = GuiUtils.getAvailableColors().length;
        int colorIndex = row % length;
        Color color = GuiUtils.getAvailableColors()[colorIndex];
        g2.setPaint(color);

        // draw the upper whisker
        g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3));
        g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(), yyMax));
        // draw the lower whisker
        g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1));
        g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(), yyMin));

        // draw the body
        box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3), state.getBarWidth(), Math.abs(yyQ1 - yyQ3));
        g2.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 175));

        //            if (getFillBox()) {
        //                g2.fill(box);
        //            }
        g2.draw(box);
    }

    // draw mean 
    g2.setPaint(getArtifactPaint());
    double yyAverage = 0.0;
    double aRadius = 2.0; // mean radius                       
    Number yMean = bawDataset.getMeanValue(row, column);
    if (yMean != null) {
        yyAverage = rangeAxis.valueToJava2D(yMean.doubleValue(), dataArea, location);
        Ellipse2D.Double avgEllipse = new Ellipse2D.Double((xxmid - aRadius), (yyAverage - aRadius),
                aRadius * 2, aRadius * 2);
        g2.draw(avgEllipse);
    }

    //draw median
    double yyMedian = 0.0;
    Number yMedian = bawDataset.getMedianValue(row, column);
    if (yMedian != null) {
        yyMedian = rangeAxis.valueToJava2D(yMedian.doubleValue(), dataArea, location);
        g2.draw(new Line2D.Double(xx, yyMedian, xx + state.getBarWidth(), yyMedian));
    }

    //Outliers and Farouts                 
    double oRadius = 2.0; //outlier radius
    double foRadius = 1.0; //farout radius

    // From outlier array sort out which are outliers and put these into a 
    // list. If there are any farouts, add them to the farout list.    
    // draw the outliers and farouts only if they are within the data area.
    double yyOutlier;
    double yyFarout;
    List outliers = new ArrayList();
    List farOutValues = new ArrayList();
    List yOutliers = bawDataset.getOutliers(row, column);
    if (yOutliers != null) {
        for (int i = 0; i < yOutliers.size(); i++) {
            Number outlierNum = (Number) yOutliers.get(i);
            double outlier = outlierNum.doubleValue();
            Number minOutlier = bawDataset.getMinOutlier(row, column);
            Number maxOutlier = bawDataset.getMaxOutlier(row, column);
            Number minRegular = bawDataset.getMinRegularValue(row, column);
            Number maxRegular = bawDataset.getMaxRegularValue(row, column);
            if (outlier > maxOutlier.doubleValue() || outlier < minOutlier.doubleValue()) {
                yyFarout = rangeAxis.valueToJava2D(outlier, dataArea, location);
                Outlier faroutToAdd = new Outlier(xxmid, yyFarout, foRadius);
                if (dataArea.contains(faroutToAdd.getPoint())) {
                    farOutValues.add(faroutToAdd);
                }
            } else if (outlier > maxRegular.doubleValue() || outlier < minRegular.doubleValue()) {
                yyOutlier = rangeAxis.valueToJava2D(outlier, dataArea, location);
                Outlier outlierToAdd = new Outlier(xxmid, yyOutlier, oRadius);
                if (dataArea.contains(outlierToAdd.getPoint())) {
                    outliers.add(outlierToAdd);
                }
            }
        }

        //draw the outliers
        g2.setPaint(this.outlierPaint);
        for (Iterator iterator = outliers.iterator(); iterator.hasNext();) {
            Outlier outlier = (Outlier) iterator.next();
            Point2D point = outlier.getPoint();
            Shape dot = createEllipse(point, oRadius);
            g2.draw(dot);
        }

        //draw the farout values
        g2.setPaint(this.farOutColor);
        for (Iterator iterator = farOutValues.iterator(); iterator.hasNext();) {
            Outlier outlier = (Outlier) iterator.next();
            Point2D point = outlier.getPoint();
            Shape triangle = createTriangleVertical(point, foRadius);
            g2.draw(triangle);
        }
    }
}

From source file:org.datavyu.views.DataControllerV.java

private static String toRGBString(final Color color) {
    return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue());
}

From source file:org.kurento.test.browser.WebPage.java

public boolean compareColor(String videoTag, Color expectedColor, boolean logWarn) {
    @SuppressWarnings("unchecked")
    List<Long> realColor = (List<Long>) browser
            .executeScriptAndWaitOutput("return kurentoTest.colorInfo['" + videoTag + "'].currentColor;");

    long red = realColor.get(0);
    long green = realColor.get(1);
    long blue = realColor.get(2);

    double distance = Math.sqrt((red - expectedColor.getRed()) * (red - expectedColor.getRed())
            + (green - expectedColor.getGreen()) * (green - expectedColor.getGreen())
            + (blue - expectedColor.getBlue()) * (blue - expectedColor.getBlue()));

    String expectedColorStr = "[R=" + expectedColor.getRed() + ", G=" + expectedColor.getGreen() + ", B="
            + expectedColor.getBlue() + "]";
    String realColorStr = "[R=" + red + ", G=" + green + ", B=" + blue + "]";
    boolean out = distance <= browser.getColorDistance();
    if (!out) {//  ww  w  .  j a va 2  s . c  om
        if (logWarn) {
            log.warn("Color NOT detected in video stream. Expected: {}, Real: {}", expectedColorStr,
                    realColorStr);
        }
    } else {
        log.debug("Detected color in video stream. Expected: {}, Real: {}", expectedColorStr, realColorStr);
    }

    return out;
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.WellsModel.java

/**
 * Handles the selection of a cell//from  w w w. ja v  a 2s  . c  o  m
 * 
 * @param cell The selected cell.
 * @param well The well to handle.
 * @param results The collection of objects to update.
 */
private void handleCellSelection(CellDisplay cell, WellImageSet well, List<DataObject> results) {
    String description = cell.getDescription();
    Color c = cell.getHighlight();
    WellData data = (WellData) well.getHierarchyObject();
    data.setWellType(description);
    well.setDescription(description);
    results.add(data);
    if (c == null || !cell.isSpecified()) {
        data.setRed(null);
    } else {
        data.setRed(c.getRed());
        data.setGreen(c.getGreen());
        data.setBlue(c.getBlue());
        data.setAlpha(c.getAlpha());
    }
    well.setHighlight(c);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImpl.java

/**
 * Internal implementation to add a sunburst chart (actually a doughnut chart) to a slide, based on a template.
 * @param template the parsed template information.
 * @param slide the slide to add to.// w ww  .  j a  v a  2  s .c o m
 * @param anchor optional bounding rectangle to draw onto, in PowerPoint coordinates.
 *               If null, we'll use the bounds from the original template chart.
 * @param data the sunburst data.
 * @param shapeId the slide shape ID, should be unique within the slide.
 * @param relId the relation ID to the chart data.
 * @throws TemplateLoadException if we can't create the sunburst; most likely due to an invalid template.
 */
private static void addSunburst(final SlideShowTemplate template, final XSLFSlide slide,
        final Rectangle2D.Double anchor, final SunburstData data, final int shapeId, final String relId)
        throws TemplateLoadException {
    final String[] categories = data.getCategories();
    final double[] values = data.getValues();
    final String title = data.getTitle();

    slide.getXmlObject().getCSld().getSpTree().addNewGraphicFrame()
            .set(template.getDoughnutChartShapeXML(relId, shapeId, "chart" + shapeId, anchor));

    final XSSFWorkbook workbook = new XSSFWorkbook();
    final XSSFSheet sheet = workbook.createSheet();

    final XSLFChart baseChart = template.getDoughnutChart();

    final CTChartSpace chartSpace = (CTChartSpace) baseChart.getCTChartSpace().copy();
    final CTChart ctChart = chartSpace.getChart();
    final CTPlotArea plotArea = ctChart.getPlotArea();

    if (StringUtils.isEmpty(title)) {
        if (ctChart.getAutoTitleDeleted() != null) {
            ctChart.getAutoTitleDeleted().setVal(true);
        }

        ctChart.unsetTitle();
    }

    final CTDoughnutChart donutChart = plotArea.getDoughnutChartArray(0);

    final CTPieSer series = donutChart.getSerArray(0);

    final CTStrRef strRef = series.getTx().getStrRef();
    strRef.getStrCache().getPtArray(0).setV(title);
    sheet.createRow(0).createCell(1).setCellValue(title);
    strRef.setF(new CellReference(sheet.getSheetName(), 0, 1, true, true).formatAsString());

    final CTStrRef categoryRef = series.getCat().getStrRef();
    final CTStrData categoryData = categoryRef.getStrCache();
    final CTNumRef numRef = series.getVal().getNumRef();
    final CTNumData numericData = numRef.getNumCache();

    final String[] fillColors = data.getColors();
    final String[] strokeColors = data.getStrokeColors();
    final boolean overrideFill = ArrayUtils.isNotEmpty(fillColors);
    final boolean overrideStroke = ArrayUtils.isNotEmpty(strokeColors);
    final boolean overrideColors = overrideFill || overrideStroke;
    final List<CTDPt> dPtList = series.getDPtList();
    final CTDPt templatePt = (CTDPt) dPtList.get(0).copy();
    if (overrideColors) {
        dPtList.clear();

        final CTShapeProperties spPr = templatePt.getSpPr();
        final CTLineProperties ln = spPr.getLn();

        // We need to unset any styles on the existing template
        if (overrideFill) {
            unsetSpPrFills(spPr);
        }

        if (overrideStroke) {
            unsetLineFills(ln);
        }
    }

    categoryData.setPtArray(null);
    numericData.setPtArray(null);

    CTLegend legend = null;
    final int[] showInLegend = data.getShowInLegend();
    int nextLegendToShow = 0, nextLegendToShowIdx = -1;
    if (showInLegend != null) {
        // We need to write legendEntry elements to hide the legend for chart series we don't want.
        // Note this only works in PowerPoint, and not OpenOffice.
        legend = ctChart.isSetLegend() ? ctChart.getLegend() : ctChart.addNewLegend();
        Arrays.sort(showInLegend);
        nextLegendToShow = showInLegend[++nextLegendToShowIdx];
    }

    for (int idx = 0; idx < values.length; ++idx) {
        final CTStrVal categoryPoint = categoryData.addNewPt();
        categoryPoint.setIdx(idx);
        categoryPoint.setV(categories[idx]);

        final CTNumVal numericPoint = numericData.addNewPt();
        numericPoint.setIdx(idx);
        numericPoint.setV(Double.toString(values[idx]));

        if (overrideColors) {
            final CTDPt copiedPt = (CTDPt) templatePt.copy();
            copiedPt.getIdx().setVal(idx);

            if (overrideFill) {
                final Color color = Color.decode(fillColors[idx % fillColors.length]);
                final CTSolidColorFillProperties fillClr = copiedPt.getSpPr().addNewSolidFill();
                fillClr.addNewSrgbClr().setVal(
                        new byte[] { (byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue() });
            }

            if (overrideStroke) {
                final Color strokeColor = Color.decode(strokeColors[idx % strokeColors.length]);
                final CTSolidColorFillProperties strokeClr = copiedPt.getSpPr().getLn().addNewSolidFill();
                strokeClr.addNewSrgbClr().setVal(new byte[] { (byte) strokeColor.getRed(),
                        (byte) strokeColor.getGreen(), (byte) strokeColor.getBlue() });
            }

            dPtList.add(copiedPt);
        }

        if (legend != null) {
            // We're hiding some legend elements. Should we show this index?
            if (nextLegendToShow == idx) {
                // We show this index, find the next one to show.
                ++nextLegendToShowIdx;
                if (nextLegendToShowIdx < showInLegend.length) {
                    nextLegendToShow = showInLegend[nextLegendToShowIdx];
                }
            } else {
                // We hide this index. If there's already a matching legend entry in the XML, update it,
                //   otherwise we create a new legend entry.
                boolean found = false;
                for (int ii = 0, max = legend.sizeOfLegendEntryArray(); ii < max; ++ii) {
                    final CTLegendEntry legendEntry = legend.getLegendEntryArray(ii);
                    final CTUnsignedInt idxLegend = legendEntry.getIdx();
                    if (idxLegend != null && idxLegend.getVal() == idx) {
                        found = true;
                        if (legendEntry.isSetDelete()) {
                            legendEntry.getDelete().setVal(true);
                        } else {
                            legendEntry.addNewDelete().setVal(true);
                        }
                    }
                }

                if (!found) {
                    final CTLegendEntry idxLegend = legend.addNewLegendEntry();
                    idxLegend.addNewIdx().setVal(idx);
                    idxLegend.addNewDelete().setVal(true);
                }
            }
        }

        XSSFRow row = sheet.createRow(idx + 1);
        row.createCell(0).setCellValue(categories[idx]);
        row.createCell(1).setCellValue(values[idx]);
    }
    categoryData.getPtCount().setVal(categories.length);
    numericData.getPtCount().setVal(values.length);

    categoryRef.setF(new CellRangeAddress(1, values.length, 0, 0).formatAsString(sheet.getSheetName(), true));
    numRef.setF(new CellRangeAddress(1, values.length, 1, 1).formatAsString(sheet.getSheetName(), true));

    try {
        writeChart(template.getSlideShow(), slide, baseChart, chartSpace, workbook, relId);
    } catch (IOException | InvalidFormatException e) {
        throw new TemplateLoadException("Error writing chart in loaded template", e);
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.ESResultsTablePanel.java

/**
 * Builds the "more" panel./*from w  ww .  j  ava2  s.com*/
 *
 */
protected void buildMorePanel() {
    FormLayout formLayout = new FormLayout("15px,0px,p", "p");
    PanelBuilder builder = new PanelBuilder(formLayout);
    CellConstraints cc = new CellConstraints();

    moreBtn = createButton(
            String.format(getResourceString("MoreEntries"), new Object[] { (rowCount - topNumEntries) }));//(rowCount - topNumEntries)+" more...");
    moreBtn.setCursor(handCursor);

    moreBtn.setBorderPainted(false);
    builder.add(createLabel(" "), cc.xy(1, 1));
    builder.add(moreBtn, cc.xy(3, 1));

    morePanel = builder.getPanel();
    Color bgColor = table.getBackground();
    bgColor = new Color(Math.max(bgColor.getRed() - 10, 0), Math.max(bgColor.getGreen() - 10, 0),
            Math.max(bgColor.getBlue() - 10, 0));

    Color fgColor = new Color(Math.min(bannerColor.getRed() + 10, 255),
            Math.min(bannerColor.getGreen() + 10, 255), Math.min(bannerColor.getBlue() + 10, 255));
    morePanel.setBackground(bgColor);
    moreBtn.setBackground(bgColor);
    moreBtn.setForeground(fgColor);
    add(builder.getPanel(), BorderLayout.SOUTH);

    moreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            morePanel.setVisible(false);
            showTopNumEntriesBtn.setVisible(true);
            showingAllRows = true;
            setDisplayRows(rowCount, Integer.MAX_VALUE);
            esrPane.revalidateScroll();
        }
    });

    morePanel.setVisible(false);
}

From source file:userinterface.graph.AxisSettings.java

public void save(Element axis) throws SettingException {
    axis.setAttribute("heading", getHeading());

    Font headingFont = getHeadingFont().f;
    axis.setAttribute("headingFontName", headingFont.getName());
    axis.setAttribute("headingFontSize", "" + headingFont.getSize());
    axis.setAttribute("headingFontStyle", "" + headingFont.getStyle());

    Color headingFontColor = getHeadingFont().c;
    axis.setAttribute("headingFontColourR", "" + headingFontColor.getRed());
    axis.setAttribute("headingFontColourG", "" + headingFontColor.getGreen());
    axis.setAttribute("headingFontColourB", "" + headingFontColor.getBlue());

    Font numberFont = getNumberFont().f;
    axis.setAttribute("numberFontName", numberFont.getName());
    axis.setAttribute("numberFontSize", "" + numberFont.getSize());
    axis.setAttribute("numberFontStyle", "" + numberFont.getStyle());

    Color numberFontColor = getHeadingFont().c;
    axis.setAttribute("numberFontColourR", "" + numberFontColor.getRed());
    axis.setAttribute("numberFontColourG", "" + numberFontColor.getGreen());
    axis.setAttribute("numberFontColourB", "" + numberFontColor.getBlue());

    axis.setAttribute("showMajor", showGrid() ? "true" : "false");

    Color gridColor = gridColour.getColorValue();
    axis.setAttribute("majorColourR", "" + gridColor.getRed());
    axis.setAttribute("majorColourG", "" + gridColor.getGreen());
    axis.setAttribute("majorColourB", "" + gridColor.getBlue());

    axis.setAttribute("logarithmic", isLogarithmic() ? "true" : "false");

    axis.setAttribute("minValue", "" + getMinValue());
    axis.setAttribute("maxValue", "" + getMaxValue());

    axis.setAttribute("majorGridInterval", "" + getGridInterval());
    axis.setAttribute("logBase", "" + getLogBase());
    axis.setAttribute("logStyle", "" + getLogStyle());

    axis.setAttribute("minimumPower", "" + getMinimumPower());
    axis.setAttribute("maximumPower", "" + getMaximumPower());

    axis.setAttribute("autoscale", isAutoScale() ? "true" : "false");
}