Example usage for java.awt Graphics2D fillRect

List of usage examples for java.awt Graphics2D fillRect

Introduction

In this page you can find the example usage for java.awt Graphics2D fillRect.

Prototype

public abstract void fillRect(int x, int y, int width, int height);

Source Link

Document

Fills the specified rectangle.

Usage

From source file:juicebox.mapcolorui.HeatmapRenderer.java

/**
 * Render a dense matrix. Used for Pearsons correlation.  The bitmap is drawn at 1 data point
 * per pixel, scaling happens elsewhere.
 *
 * @param rm         Matrix to render/*www . j a  va 2s. c  o  m*/
 * @param originX    origin in pixels
 * @param originY    origin in pixels
 * @param colorScale color scale to apply
 * @param g          graphics to render matrix into
 */
private void renderMatrix(BasicMatrix rm, int originX, int originY, int width, int height,
        ColorScale colorScale, Graphics2D g) {

    int endX = Math.min(originX + width, rm.getColumnDimension());
    int endY = Math.min(originY + height, rm.getRowDimension());

    for (int row = originY; row < endY; row++) {
        for (int col = originX; col < endX; col++) {

            float score = rm.getEntry(row, col);
            Color color;
            if (Float.isNaN(score)) {
                color = Color.gray;
            } else {
                color = score == 0 ? Color.black : colorScale.getColor(score);
            }
            int px = col - originX;
            int py = row - originY;
            g.setColor(color);
            //noinspection SuspiciousNameCombination
            g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH);
            // Assuming same chromosome
            if (col != row) {
                px = row - originX;
                py = col - originY;
                g.fillRect(px, py, HiCGlobals.BIN_PIXEL_WIDTH, HiCGlobals.BIN_PIXEL_WIDTH);
            }
        }
    }
}

From source file:krasa.cpu.CpuUsagePanel.java

@Override
public void paintComponent(final Graphics g) {
    final boolean pressed = getModel().isPressed();
    final boolean stateChanged = myWasPressed != pressed;
    myWasPressed = pressed;/*from  www. ja v a2 s.com*/
    Image bufferedImage = myBufferedImage;

    if (bufferedImage == null || stateChanged) {
        final Dimension size = getSize();
        final Insets insets = getInsets();

        bufferedImage = UIUtil.createImage(g, size.width, size.height, BufferedImage.TYPE_INT_ARGB);
        final Graphics2D g2 = (Graphics2D) bufferedImage.getGraphics().create();

        final int max = 100;
        int system = CpuUsageManager.system;
        int process = CpuUsageManager.process;
        final int otherProcesses = system - process;

        final int totalBarLength = size.width - insets.left - insets.right - 3;
        final int processUsageBarLength = totalBarLength * process / max;
        final int otherProcessesUsageBarLength = totalBarLength * otherProcesses / max;
        final int barHeight = Math.max(size.height, getFont().getSize() + 2);
        final int yOffset = (size.height - barHeight) / 2;
        final int xOffset = insets.left;

        // background
        g2.setColor(UIUtil.getPanelBackground());
        g2.fillRect(0, 0, size.width, size.height);

        // gauge (ide)
        g2.setColor(ideColor);
        g2.fillRect(xOffset + 1, yOffset, processUsageBarLength + 1, barHeight);

        // gauge (system)
        g2.setColor(systemColor);
        g2.fillRect(xOffset + processUsageBarLength + 1, yOffset, otherProcessesUsageBarLength + 1, barHeight);

        // label
        g2.setFont(getFont());
        // final String info = CpuUsageBundle.message("cpu.usage.panel.message.text", CpuUsageManager.process,
        // CpuUsageManager.system);
        final String info = fixedLengthString(String.valueOf(process), 3) + "% / "
                + fixedLengthString(String.valueOf(system), 3) + "%";

        final FontMetrics fontMetrics = g.getFontMetrics();
        final int infoWidth = fontMetrics.charsWidth(info.toCharArray(), 0, info.length());
        final int infoHeight = fontMetrics.getAscent();
        UISettings.setupAntialiasing(g2);

        final Color fg = pressed ? UIUtil.getLabelDisabledForeground() : JBColor.foreground();
        g2.setColor(fg);
        g2.drawString(info, xOffset + (totalBarLength - infoWidth) / 2,
                yOffset + infoHeight + (barHeight - infoHeight) / 2 - 1);

        // border
        g2.setStroke(new BasicStroke(1));
        g2.setColor(JBColor.GRAY);
        g2.drawRect(0, 0, size.width - 2, size.height - 1);

        g2.dispose();
        myBufferedImage = bufferedImage;
    }

    draw(g, bufferedImage);
}

From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToBoxPlot.java

@Override
public void renderCellSD(Double v, VNode rowNode, VNode columnNode, Graphics2D g2D, int anchorX, int anchorY,
        int cellWidth, int cellHeight) {
    if (v == null || v.isNaN()) {
        //System.out.println(v);
        _markNull(v, rowNode, columnNode, g2D, anchorX, anchorY, cellWidth, cellHeight);
    } else {/*from w w w  . j av a 2  s  .  co  m*/
        try {
            g2D.setColor(UI.colorBlack2);
            g2D.fillRect((int) anchorX, (int) anchorY, (int) cellWidth, (int) cellHeight);
            g2D.setColor(barColorNormal);

            //                g2D.setStroke(null);
            g2D.setStroke(UI.stroke1_5);

            //This is the 
            //int height = (int)Math.round(cellHeight * (v - _minValue)/(_maxValue - _minValue));
            //g2D.fillRect(Math.round(anchorX), Math.round(anchorY + cellHeight - height), Math.round(cellWidth), Math.round(cellHeight));
            if (rowNode.isSingleNode() && columnNode.isSingleNode()) {

                double medianP = (v - _minValue) / (_maxValue - _minValue);
                if (v >= disectBound) {
                    g2D.setColor(barColorNormal);
                } else {
                    g2D.setColor(barColorBelow);

                }

                g2D.drawLine((int) (anchorX + 1), (int) (anchorY + cellHeight - cellHeight * medianP),
                        (int) (anchorX + cellWidth - 1), (int) (anchorY + cellHeight - cellHeight * medianP));
            } else {

                //                    double min = percentile.evaluate(valueArray, 0);
                //                    double max = percentile.evaluate(valueArray, 100)
                double fiveVal[] = boxPlotValues(getCoolMapObject(), rowNode, columnNode);
                if (fiveVal == null) {
                    g2D.setColor(UI.colorBlack1);
                    g2D.drawRect(Math.round(anchorX), Math.round(anchorY), Math.round(cellWidth),
                            Math.round(cellHeight));
                }

                double range = _maxValue - _minValue;
                double minP = (fiveVal[0] - _minValue) / range;
                double maxP = (fiveVal[4] - _minValue) / range;
                double medianP = (fiveVal[2] - _minValue) / range;
                double q1P = (fiveVal[1] - _minValue) / range;
                double q3P = (fiveVal[3] - _minValue) / range;

                try {
                    g2D.drawLine((int) (anchorX + cellWidth / 2),
                            (int) (anchorY + cellHeight - cellHeight * maxP), (int) (anchorX + cellWidth / 2),
                            (int) (anchorY + cellHeight - cellHeight * minP));

                    if (fiveVal[2] >= disectBound) {
                        g2D.setColor(UI.colorLightGreen4);
                    } else {
                        g2D.setColor(UI.colorOrange2);
                    }

                    g2D.fillRect((int) (anchorX + cellWidth / 4),
                            (int) (anchorY + cellHeight - cellHeight * q3P), (int) (cellWidth / 2),
                            (int) (cellHeight * (q3P - q1P)));

                    if (fiveVal[2] >= disectBound) {
                        g2D.setColor(barColorNormal);
                    } else {
                        g2D.setColor(barColorBelow);
                    }

                    //                        g2D.setColor(barColorNormal);
                    g2D.drawRect((int) (anchorX + cellWidth / 4),
                            (int) (anchorY + cellHeight - cellHeight * q3P), (int) (cellWidth / 2),
                            (int) (cellHeight * (q3P - q1P)));

                    g2D.drawLine((int) (anchorX + 1), (int) (anchorY + cellHeight - cellHeight * medianP),
                            (int) (anchorX + cellWidth - 1),
                            (int) (anchorY + cellHeight - cellHeight * medianP));
                } catch (Exception e) {
                    System.err.println("Boxplot render exception");
                }
            }

            g2D.setColor(UI.colorBlack1);
            g2D.drawRect(Math.round(anchorX), Math.round(anchorY), Math.round(cellWidth),
                    Math.round(cellHeight));
        } catch (Exception e) {
        }
    }
}

From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToBoxPlot.java

@Override
public void renderCellLD(Double v, VNode rowNode, VNode columnNode, Graphics2D g2D, int anchorX, int anchorY,
        int cellWidth, int cellHeight) {
    if (v == null || v.isNaN()) {
        //System.out.println(v);
        _markNull(v, rowNode, columnNode, g2D, anchorX, anchorY, cellWidth, cellHeight);
    } else {/*from   w w  w . ja  va  2  s. c om*/
        try {
            g2D.setColor(UI.colorBlack2);
            g2D.fillRect((int) anchorX, (int) anchorY, (int) cellWidth, (int) cellHeight);
            g2D.setColor(barColorNormal);
            g2D.setStroke(UI.stroke1_5);

            //This is the 
            //int height = (int)Math.round(cellHeight * (v - _minValue)/(_maxValue - _minValue));
            //g2D.fillRect(Math.round(anchorX), Math.round(anchorY + cellHeight - height), Math.round(cellWidth), Math.round(cellHeight));
            if (rowNode.isSingleNode() && columnNode.isSingleNode()) {

                double value = (v - _minValue) / (_maxValue - _minValue);

                if (v >= disectBound) {
                    g2D.setColor(barColorNormal);
                } else {
                    g2D.setColor(barColorBelow);
                }

                g2D.drawLine((int) (anchorX + 1), (int) (anchorY + cellHeight - cellHeight * value),
                        (int) (anchorX + cellWidth - 1), (int) (anchorY + cellHeight - cellHeight * value));
            } else {

                //                    double min = percentile.evaluate(valueArray, 0);
                //                    double max = percentile.evaluate(valueArray, 100)
                double fiveVal[] = boxPlotValues(getCoolMapObject(), rowNode, columnNode);
                if (fiveVal == null) {
                    g2D.setColor(UI.colorBlack1);
                    g2D.drawRect(Math.round(anchorX), Math.round(anchorY), Math.round(cellWidth),
                            Math.round(cellHeight));
                }

                double range = _maxValue - _minValue;
                double minP = (fiveVal[0] - _minValue) / range;
                double maxP = (fiveVal[4] - _minValue) / range;
                double medianP = (fiveVal[2] - _minValue) / range;
                double q1P = (fiveVal[1] - _minValue) / range;
                double q3P = (fiveVal[3] - _minValue) / range;

                try {
                    //                        if (cellWidth >= 2 && cellHeight >= 2) {
                    g2D.drawLine((int) (anchorX + cellWidth / 2),
                            (int) (anchorY + cellHeight - cellHeight * maxP), (int) (anchorX + cellWidth / 2),
                            (int) (anchorY + cellHeight - cellHeight * minP));

                    if (fiveVal[2] >= disectBound) {
                        g2D.setColor(UI.colorLightGreen4);
                    } else {
                        g2D.setColor(UI.colorOrange2);
                    }

                    g2D.fillRect((int) (anchorX), (int) (anchorY + cellHeight - cellHeight * q3P),
                            (int) (cellWidth), (int) (cellHeight * (q3P - q1P)));

                    if (fiveVal[2] >= disectBound) {
                        g2D.setColor(barColorNormal);
                    } else {
                        g2D.setColor(barColorBelow);
                    }

                    //                        g2D.setColor(barColorNormal);
                    //g2D.drawRect((int) (anchorX), (int) (anchorY + cellHeight - cellHeight * q3P), (int) (cellWidth), (int) (cellHeight * (q3P - q1P)));
                    g2D.drawLine((int) (anchorX), (int) (anchorY + cellHeight - cellHeight * medianP),
                            (int) (anchorX + cellWidth), (int) (anchorY + cellHeight - cellHeight * medianP));
                    //                        } else {
                    //
                    //                            if (fiveVal[2] >= medianP) {
                    //                                g2D.setColor(barColorNormal);
                    //                            } else {
                    //                                g2D.setColor(barColorBelow);
                    //                            }
                    //
                    ////                            System.out.println("painted rect");
                    ////                            System.out.println((int) cellWidth + " " + ((int) cellHeight));
                    //                            g2D.fillRect((int) anchorX, (int) anchorY, (int) cellWidth, (int) cellHeight);
                    //                        }

                } catch (Exception e) {
                    System.err.println("Boxplot render exception");
                }
            }

            //                if(cellWidth>=4 && cellHeight >=){
            //                    g2D.setColor(UI.colorBlack1);
            //                    g2D.drawRect(Math.round(anchorX), Math.round(anchorY), Math.round(cellWidth), Math.round(cellHeight));
            //                }
        } catch (Exception e) {
        }
    }
}

From source file:org.executequery.gui.erd.ErdTable.java

protected void drawTable(Graphics2D g, int offsetX, int offsetY) {

    if (parent == null) {

        return;// w  w w.j  av  a2 s .  c  o m
    }

    Font tableNameFont = parent.getTableNameFont();
    Font columnNameFont = parent.getColumnNameFont();

    // set the table value background
    g.setColor(TITLE_BAR_BG_COLOR);
    g.fillRect(offsetX, offsetY, FINAL_WIDTH - 1, TITLE_BAR_HEIGHT);

    // set the table value
    FontMetrics fm = g.getFontMetrics(tableNameFont);
    int lineHeight = fm.getHeight();
    int titleXPosn = (FINAL_WIDTH / 2) - (fm.stringWidth(tableName) / 2) + offsetX;

    g.setColor(Color.BLACK);
    g.setFont(tableNameFont);
    g.drawString(tableName, titleXPosn, lineHeight + offsetY);

    // draw the line separator
    lineHeight = TITLE_BAR_HEIGHT + offsetY - 1;
    g.drawLine(offsetX, lineHeight, offsetX + FINAL_WIDTH - 1, lineHeight);

    // fill the white background
    g.setColor(tableBackground);
    g.fillRect(offsetX, TITLE_BAR_HEIGHT + offsetY, FINAL_WIDTH - 1, FINAL_HEIGHT - TITLE_BAR_HEIGHT - 1);

    // add the column names
    fm = g.getFontMetrics(columnNameFont);
    int heightPlusSep = 1 + TITLE_BAR_HEIGHT + offsetY;
    int leftMargin = 5 + offsetX;

    lineHeight = fm.getHeight();
    g.setColor(Color.BLACK);
    g.setFont(columnNameFont);

    int drawCount = 0;
    String value = null;
    if (ArrayUtils.isNotEmpty(columns)) {

        for (int i = 0; i < columns.length; i++) {
            ColumnData column = columns[i];
            if (displayReferencedKeysOnly && !column.isKey()) {
                continue;
            }

            int y = (((drawCount++) + 1) * lineHeight) + heightPlusSep;
            int x = leftMargin;

            // draw the column value string
            value = column.getColumnName();
            g.drawString(value, x, y);

            // draw the data type and size string
            x = leftMargin + dataTypeOffset;
            value = column.getFormattedDataType();
            g.drawString(value, x, y);

            // draw the key label
            if (column.isKey()) {

                if (column.isPrimaryKey() && column.isForeignKey()) {

                    value = PRIMARY + FOREIGN;

                } else if (column.isPrimaryKey()) {

                    value = PRIMARY;

                } else if (column.isForeignKey()) {

                    value = FOREIGN;
                }

                x = leftMargin + dataTypeOffset + keyLabelOffset;
                g.drawString(value, x, y);
            }

        }

    }

    // draw the rectangle border
    double scale = g.getTransform().getScaleX();

    if (selected && scale != ErdPrintable.PRINT_SCALE) {
        g.setStroke(focusBorderStroke);
        g.setColor(Color.BLUE);
    } else {
        g.setColor(Color.BLACK);
    }

    g.drawRect(offsetX, offsetY, FINAL_WIDTH - 1, FINAL_HEIGHT - 1);
    //    g.setColor(Color.DARK_GRAY);
    //    g.draw3DRect(offsetX, offsetY, FINAL_WIDTH - 2, FINAL_HEIGHT - 2, true);
}

From source file:org.processmining.analysis.performance.advanceddottedchartanalysis.ui.DottedChartPanel.java

public void generateBufferedImage(Graphics grx, int width, int height) {
    overviewBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D gr = overviewBuffer.createGraphics();

    gr.setColor(colorBg);//from w ww . ja v  a  2  s .co m
    gr.fillRect(0, 0, width, height);

    if (dcop.isSizeCheckBoxSelected()) {
        drawModelBuffer(width, height, false);
    } else {
        drawModelBuffer_NO_SIZE(width, height, false);
    }
}

From source file:com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRenderListener.java

private void cleanImage(BufferedImage image, List<Rectangle> areasToBeCleaned) {
    Graphics2D graphics = image.createGraphics();
    graphics.setColor(CLEANED_AREA_FILL_COLOR);

    // A rectangle in the areasToBeCleaned list is treated to be in standard [0, 1]x[0,1] image space
    // (y varies from bottom to top and x from left to right), so we should scale the rectangle and also
    // invert and shear the y axe
    for (Rectangle rect : areasToBeCleaned) {
        int scaledBottomY = (int) Math.ceil(rect.getBottom() * image.getHeight());
        int scaledTopY = (int) Math.floor(rect.getTop() * image.getHeight());

        int x = (int) Math.ceil(rect.getLeft() * image.getWidth());
        int y = scaledTopY * -1 + image.getHeight();
        int width = (int) Math.floor(rect.getRight() * image.getWidth()) - x;
        int height = scaledTopY - scaledBottomY;

        graphics.fillRect(x, y, width, height);
    }/*from www.  j  av  a2  s.  c o m*/

    graphics.dispose();
}

From source file:de.tor.tribes.ui.panels.MinimapPanel.java

protected BufferedImage getImage() {
    BufferedImage tempImg = ImageUtils.createCompatibleBufferedImage(mapDim.width, mapDim.height,
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = (Graphics2D) tempImg.getGraphics();
    g2d.setColor(new Color(35, 125, 0));
    g2d.fillRect(0, 0, tempImg.getWidth(null), tempImg.getHeight(null));
    g2d.drawImage(mBuffer, 0, 0, null);/*from   w w  w .ja v a  2 s  .c  o m*/
    g2d.dispose();
    return tempImg;
}

From source file:de.tor.tribes.ui.panels.MinimapPanel.java

protected BufferedImage getScaledImage(int width, int height) {
    BufferedImage tempImg = ImageUtils.createCompatibleBufferedImage(width, height,
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = (Graphics2D) tempImg.getGraphics();
    g2d.setColor(new Color(35, 125, 0));
    g2d.fillRect(0, 0, tempImg.getWidth(null), tempImg.getHeight(null));
    g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g2d.drawImage(mBuffer, 0, 0, width, height, 0, 0, mBuffer.getWidth(), mBuffer.getHeight(), null);
    g2d.dispose();//  w ww . j  ava  2s .c  o m
    return tempImg;
}

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

/**
 * Creates the UI./* ww  w  .  ja  v a 2 s . c om*/
 */
@SuppressWarnings("unchecked")
protected void createUI() {
    currentSize = getCurrentSizeSquare();

    searchText = createTextField(25);
    searchSciNameBtn = createI18NButton("LM_SEARCH");
    list = new JList(listModel);
    imgDisplay = new ImageDisplay(IMG_WIDTH, IMG_HEIGHT, false, true);

    imgDisplay.setChangeListener(this);

    wwPanel = new WorldWindPanel(false);
    wwPanel.setPreferredSize(new Dimension(currentSize, currentSize));
    wwPanel.setZoomInMeters(600000.0);

    imgDisplay.setDoShowText(false);

    searchMyDataBtn = createI18NButton("LM_SRCH_SP_DATA");
    myDataTF = UIHelper.createTextField();

    CellConstraints cc = new CellConstraints();

    PanelBuilder pb1 = new PanelBuilder(new FormLayout("p,2px,f:p:g,2px,p", "p"));
    pb1.add(createI18NFormLabel("LM_SRCH_COL"), cc.xy(1, 1));
    pb1.add(searchText, cc.xy(3, 1));
    pb1.add(searchSciNameBtn, cc.xy(5, 1));

    PanelBuilder myPB = new PanelBuilder(new FormLayout("f:p:g,p", "p,2px,p,2px,p"));
    mySepComp = myPB.addSeparator(getResourceString("LM_MYDATA_TITLE"), cc.xyw(1, 1, 2));
    myPB.add(myDataTF, cc.xyw(1, 3, 2));
    myPB.add(searchMyDataBtn, cc.xy(2, 5));

    PanelBuilder pb2 = new PanelBuilder(new FormLayout("MAX(p;300px),2px,f:p:g", "f:p:g,20px,p"));
    pb2.add(createScrollPane(list), cc.xy(1, 1));
    pb2.add(myPB.getPanel(), cc.xy(1, 3));

    PanelBuilder pb3 = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "f:p:g,p,4px,p,f:p:g"));
    pb3.add(createI18NLabel("LM_WRLD_OVRVW", SwingConstants.CENTER), cc.xy(2, 2));
    pb3.add(imgDisplay, cc.xy(2, 4));

    PanelBuilder pb4 = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "f:p:g,p,4px,p,f:p:g"));
    pb4.add(createI18NLabel("LM_INTRACT_VW", SwingConstants.CENTER), cc.xy(2, 2));
    pb4.add(wwPanel, cc.xy(2, 4));

    PanelBuilder pb5 = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,p,f:p:g"));
    pb5.add(pb3.getPanel(), cc.xy(1, 1));
    pb5.add(pb4.getPanel(), cc.xy(1, 3));

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,8px,f:p:g", "p,8px,f:p:g"), this);
    pb.add(pb1.getPanel(), cc.xyw(1, 1, 3));
    pb.add(pb2.getPanel(), cc.xy(1, 3));
    pb.add(pb5.getPanel(), cc.xy(3, 3));

    updateMyDataUIState(false);

    searchText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                searchSciNameBtn.doClick();
            }
        }
    });

    myDataTF.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                searchMyDataBtn.doClick();
            }
        }
    });

    list.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (list.getSelectedIndex() == -1) {
                    wwPanel.reset();
                    imgDisplay.setImage(blueMarble);

                } else {
                    SwingWorker<Boolean, Boolean> worker = new SwingWorker<Boolean, Boolean>() {
                        @Override
                        protected Boolean doInBackground() throws Exception {
                            if (doResetWWPanel) {
                                wwPanel.reset();
                            }
                            doSearchOccur();
                            return null;
                        }

                        @Override
                        protected void done() {
                            imgDisplay.repaint();
                        }
                    };
                    worker.execute();
                }
            }
        }
    });

    searchMyDataBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    doSearchSpecifyData(myDataTF.getText().trim());
                }
            });

        }
    });

    searchSciNameBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doSearchGenusSpecies();
        }
    });

    blueMarbleListener = new BufferedImageFetcherIFace() {
        @Override
        public void imageFetched(BufferedImage image) {
            blueMarble = image;
            imgDisplay.setImage(blueMarble);
        }

        @Override
        public void error() {
            blueMarbleTries++;
            if (blueMarbleTries < 5) {
                blueMarbleRetry();
            }
        }
    };

    blueMarbleURL = BG_URL + String.format("WIDTH=%d&HEIGHT=%d", IMG_WIDTH, IMG_HEIGHT);

    pointsMapImageListener = new BufferedImageFetcherIFace() {
        @Override
        public void imageFetched(final BufferedImage image) {
            if (renderImage == null) {
                renderImage = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
            }
            Graphics2D g2d = renderImage.createGraphics();
            if (g2d != null) {
                g2d.fillRect(0, 0, IMG_WIDTH, IMG_HEIGHT);
                if (blueMarble != null) {
                    g2d.drawImage(blueMarble, 0, 0, null);
                }
                if (image != null) {
                    g2d.drawImage(image, 0, 0, null);
                }
                g2d.dispose();

                imgDisplay.setImage(renderImage);
            }
        }

        @Override
        public void error() {
        }
    };
    blueMarbleRetry();
}