Example usage for java.awt Color gray

List of usage examples for java.awt Color gray

Introduction

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

Prototype

Color gray

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

Click Source Link

Document

The color gray.

Usage

From source file:at.tuwien.ifs.somtoolbox.visualization.ClusterConnectionsVisualizer.java

/** Gets the colour representing a certain distance value. */
private Color getColor(double distance) {
    if (distance <= t1) {
        return Color.BLACK;
    } else if (distance > t1 && distance <= t2) {
        return Color.GRAY;
    } else if (distance > t2 && distance <= t3) {
        return Color.LIGHT_GRAY;
    } else if (distance > t3) {
        return Color.WHITE;
    } else {/* w w w .j a v a 2  s  .c o  m*/
        throw new IllegalStateException("This can't happen.");
    }
}

From source file:net.pandoragames.far.ui.swing.FileListPanel.java

private void init(SwingConfig config, ComponentRepository componentRepository) {

    this.setLayout(new BorderLayout());

    this.setBorder(
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));

    tableModel = componentRepository.getTableModel();
    componentRepository.getResetDispatcher().addResetable(tableModel);
    componentRepository.getSearchBaseListener().addResetable(tableModel);
    componentRepository.getUndoListener().setTableModel(tableModel);

    JTable fileListTable = componentRepository.getFileSetTable();
    int totalWidth = fileListTable.getPreferredSize().width;
    fileListTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    fileListTable.setColumnSelectionAllowed(true);
    fileListTable.getTableHeader().addMouseListener(new TableHeaderMouseListener());
    fileListTable.getTableHeader().getColumnModel().getColumn(0)
            .setHeaderRenderer(new TableHeaderCheckBoxColumnRenderer());
    fileListPopupMenu = new FileListPopupMenu(fileListTable, tableModel, componentRepository, config);
    fileListTable.setComponentPopupMenu(fileListPopupMenu);
    fileListTable.addMouseListener(new FileViewOpener(fileListTable, componentRepository.getRootWindow(),
            config, componentRepository));
    fileListTable.getColumnModel().getColumn(0).setPreferredWidth(20);
    fileListTable.getColumnModel().getColumn(0).setMaxWidth(20);
    fileListTable.getColumnModel().getColumn(1).setCellRenderer(new TargetFileListTableCellRenderer());
    fileListTable.getColumnModel().getColumn(1).setPreferredWidth(2 * totalWidth / 5);
    fileListTable.getColumnModel().getColumn(2).setCellRenderer(new PathColumnRenderer());
    fileListTable.getColumnModel().getColumn(3).setCellRenderer(new InfoColumnRenderer(config));
    JScrollPane scrollPane = new JScrollPane(fileListTable);
    this.add(scrollPane, BorderLayout.CENTER);

    SelectCounter fileCounter = new SelectCounter();
    fileCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    fileCounter.setForeground(Color.GRAY);
    ErrorCounter errorCounter = new ErrorCounter();
    errorCounter.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    JPanel counterLine = new JPanel();
    counterLine.setLayout(new BorderLayout());
    counterLine.add(fileCounter, BorderLayout.WEST);
    counterLine.add(errorCounter, BorderLayout.EAST);

    JProgressBar progressBar = new JProgressBar();
    progressBar.setEnabled(false);//w  ww .j ava2s  .c o m
    progressBar.setMaximumSize(new Dimension(100, 20));
    progressBar.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    componentRepository.getProgressBarUpdater().setProgressBar(progressBar);
    JPanel progressBarPanel = new JPanel();
    progressBarPanel.add(progressBar);
    counterLine.add(progressBarPanel, BorderLayout.CENTER);

    counterLine.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    this.add(counterLine, BorderLayout.SOUTH);

    tableModel.addTableModelListener(new ColumnCountListener(fileCounter));
    tableModel.addTableModelListener(errorCounter);
    componentRepository.getResetDispatcher().addResetable(fileCounter);
    componentRepository.getSearchBaseListener().addResetable(fileCounter);
    componentRepository.getOperationCallBackListener().addComponentStartReseted(fileCounter,
            OperationType.FIND);
    componentRepository.getResetDispatcher().addResetable(errorCounter);
    componentRepository.getSearchBaseListener().addResetable(errorCounter);

    viewAction = new ActionView(componentRepository, config);
}

From source file:ucar.unidata.idv.control.chart.TrackSegment.java

/**
 * Draws the wayPoint.//from w ww . j a v  a2  s  . c o m
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param rendererIndex  the renderer index.
 * @param info  an optional info object that will be populated with
 *              entity information.
 */
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis,
        int rendererIndex, PlotRenderingInfo info) {
    super.setGraphicsState(g2);

    if (!getPlotWrapper().okToDraw(this)) {
        return;
    }
    WayPoint leftWayPoint = getLeft();
    WayPoint rightWayPoint = getRight();
    g2.setStroke(new BasicStroke());
    int x1 = leftWayPoint.getXFromValue(dataArea, domainAxis);
    int x2 = rightWayPoint.getXFromValue(dataArea, domainAxis);
    int top = (int) (dataArea.getY());
    int bottom = (int) (dataArea.getY() + dataArea.getHeight());
    FontMetrics fm = g2.getFontMetrics();
    int width = fm.stringWidth(getName());
    int height = fm.getAscent() + fm.getDescent();
    if (getSelected()) {
        g2.setColor(Color.red);
    } else {
        g2.setColor(Color.black);
    }
    //      int y = bottom-3;
    y = top - 2;
    int textLeft = x1 + (x2 - x1) / 2 - width / 2;
    g2.drawString(getName(), textLeft, y);
    g2.setStroke(new BasicStroke(2.0f));
    g2.drawLine(x1, top + 1, x2, top + 1);
    g2.setStroke(new BasicStroke(1.0f));
    g2.setColor(Color.gray);
    g2.drawLine(x1, top, x1, bottom - WayPoint.ANNOTATION_WIDTH);
    g2.drawLine(x2, top, x2, bottom - WayPoint.ANNOTATION_WIDTH);
}

From source file:org.limy.eclipse.qalab.task.DistanceGraphTask.java

/**
 * @param dataset // ww w.  ja v  a 2  s. c om
 * @throws IOException 
 * 
 */
private void drawGraph(XYDataset dataset) throws IOException {

    JFreeChart chart = ChartFactory.createScatterPlot("Distance from the Main Sequence", "Instability",
            "Abstractness", dataset, PlotOrientation.VERTICAL, false, false, false);

    XYPlot plot = chart.getXYPlot();

    plot.getRenderer().addAnnotation(
            new XYLineAnnotation(-0.1, 1.1, 1.1, -0.1, new BasicStroke(2), new Color(50, 220, 50)),
            Layer.BACKGROUND);

    plot.getRenderer().setShape(new Ellipse2D.Double(-4, -4, 8, 8));
    plot.getRenderer().setPaint(new Color(0xec, 0x76, 0x37));

    plot.getDomainAxis().setRangeWithMargins(0, 1);
    plot.getRangeAxis().setRangeWithMargins(0, 1);

    chart.getTitle().setPaint(Color.BLUE);

    plot.setDomainCrosshairVisible(true);
    plot.setDomainCrosshairPaint(Color.GRAY);
    plot.setRangeCrosshairVisible(true);
    plot.setRangeCrosshairPaint(Color.GRAY);

    LimyGraphUtils.writeImagePng(chart, out, 400, 380);

}

From source file:gov.nih.nci.rembrandt.web.helper.PCAAppletHelper.java

public static String generateParams(String sessionId, String taskId) {
    String htm = "";
    DecimalFormat nf = new DecimalFormat("0.0000");

    try {/*from   w ww  . j  ava  2 s  .  com*/
        //retrieve the Finding from cache and build the list of PCAData points
        PrincipalComponentAnalysisFinding principalComponentAnalysisFinding = (PrincipalComponentAnalysisFinding) businessTierCache
                .getSessionFinding(sessionId, taskId);

        ArrayList<PrincipalComponentAnalysisDataPoint> pcaData = new ArrayList();

        Collection<ClinicalFactorType> clinicalFactors = new ArrayList<ClinicalFactorType>();
        List<String> sampleIds = new ArrayList();
        Map<String, PCAresultEntry> pcaResultMap = new HashMap<String, PCAresultEntry>();

        List<PCAresultEntry> pcaResults = principalComponentAnalysisFinding.getResultEntries();
        for (PCAresultEntry pcaEntry : pcaResults) {
            sampleIds.add(pcaEntry.getSampleId());
            pcaResultMap.put(pcaEntry.getSampleId(), pcaEntry);
        }

        Collection<SampleResultset> validatedSampleResultset = ClinicalDataValidator
                .getValidatedSampleResultsetsFromSampleIDs(sampleIds, clinicalFactors);

        if (validatedSampleResultset != null) {
            String id;
            PCAresultEntry entry;

            for (SampleResultset rs : validatedSampleResultset) {
                id = rs.getBiospecimen().getSpecimenName();
                entry = pcaResultMap.get(id);
                PrincipalComponentAnalysisDataPoint pcaPoint = new PrincipalComponentAnalysisDataPoint(id,
                        entry.getPc1(), entry.getPc2(), entry.getPc3());
                String diseaseName = rs.getDisease().getValueObject();
                if (diseaseName != null) {
                    pcaPoint.setDiseaseName(diseaseName);
                } else {
                    pcaPoint.setDiseaseName(DiseaseType.NON_TUMOR.name());
                }
                GenderDE genderDE = rs.getGenderCode();
                if (genderDE != null) {
                    String gt = genderDE.getValueObject();
                    if (gt != null) {
                        GenderType genderType = GenderType.valueOf(gt);
                        if (genderType != null) {
                            pcaPoint.setGender(genderType);
                        }
                    }
                }
                Long survivalLength = rs.getSurvivalLength();
                if (survivalLength != null) {
                    //survival length is stored in days in the DB so divide by 30 to get the 
                    //approx survival in months
                    double survivalInMonths = survivalLength.doubleValue() / 30.0;
                    pcaPoint.setSurvivalInMonths(survivalInMonths);
                }
                pcaData.add(pcaPoint);
            }
        }

        //make a hashmap
        // [key=group] hold the array of double[][]s
        HashMap<String, ArrayList> hm = new HashMap();

        //now we should have a collection of PCADataPts
        double[][] pts = new double[pcaData.size()][3];
        for (int i = 0; i < pcaData.size(); i++) {
            //just create a large 1 set for now
            //are we breaking groups by gender or disease?
            PrincipalComponentAnalysisDataPoint pd = pcaData.get(i);

            pts[i][0] = pd.getPc1value();
            pts[i][1] = pd.getPc2value();
            pts[i][2] = pd.getPc3value();
            ArrayList<double[]> al;

            try {
                if (hm.containsKey(pd.getDiseaseName())) {
                    //already has it, so add this one
                    al = (ArrayList) hm.get(pd.getDiseaseName());
                } else {
                    al = new ArrayList();
                    hm.put(pd.getDiseaseName(), new ArrayList());
                }
                if (!al.contains(pts[i])) {
                    al.add(pts[i]);
                }
                hm.put(pd.getDiseaseName(), al);
            } catch (Exception e) {
                System.out.print(e.toString());
            }
        }
        int r = hm.size();
        if (r == 1) {
        }
        //hm should now contain a hashmap of all the disease groups

        //generate the param tags
        htm += "<param name=\"key\" value=\"" + taskId + "\" >\n";
        htm += "<param name=\"totalPts\" value=\"" + pts.length + "\" >\n";
        htm += "<param name=\"totalGps\" value=\"" + hm.size() + "\" >\n";
        int ii = 0;
        for (Object k : hm.keySet()) {
            String key = k.toString();
            //for each group

            Color diseaseColor = Color.GRAY;
            if (DiseaseType.valueOf(key) != null) {
                DiseaseType disease = DiseaseType.valueOf(key);
                diseaseColor = disease.getColor();
            }

            ArrayList<double[]> al = hm.get(key);
            htm += "<param name=\"groupLabel_" + ii + "\" value=\"" + key + "\" >\n";
            htm += "<param name=\"groupCount_" + ii + "\" value=\"" + al.size() + "\" >\n";
            htm += "<param name=\"groupColor_" + ii + "\" value=\"" + diseaseColor.getRGB() + "\" >\n";
            int jj = 0;
            for (double[] d : al) {
                String comm = nf.format(d[0]) + "," + nf.format(d[1]) + "," + nf.format(d[2]);
                String h = "<param name=\"pt_" + ii + "_" + jj + "\" value=\"" + comm + "\">\n";
                htm += h;
                jj++;
            }
            ii++;
        }
        /*
         //for bulk rendering
        for(int i=0; i<pts.length; i++)   {
           String comm = String.valueOf(pts[i][0]) + "," +
           String.valueOf(pts[i][1]) + "," +
           String.valueOf(pts[i][2]);
                   
           String h = "<param name=\"pt_"+i+"\" value=\""+ comm +"\">\n";
           //htm += h;
        }
        */

    } //try
    catch (Exception e) {

    }

    return htm;
}

From source file:com.att.aro.ui.view.diagnostictab.plot.NetworkTypePlot.java

private void setRenderingColorForDataSeries(XYItemRenderer renderer,
        final XYIntervalSeriesCollection dataSeries) {
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.none), Color.WHITE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.LTE), Color.RED);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.WIFI), Color.BLUE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.UMTS), Color.PINK);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.ETHERNET), Color.BLACK);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSDPA), Color.YELLOW);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPA), Color.ORANGE);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPAP), Color.MAGENTA);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSUPA), Color.CYAN);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.GPRS), Color.GRAY);
    renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.EDGE), Color.LIGHT_GRAY);
}

From source file:Paints.java

/** Draw the example */
public void paint(Graphics g1) {
    Graphics2D g = (Graphics2D) g1;
    // Paint the entire background using a GradientPaint.
    // The background color varies diagonally from deep red to pale blue
    g.setPaint(new GradientPaint(0, 0, new Color(150, 0, 0), WIDTH, HEIGHT, new Color(200, 200, 255)));
    g.fillRect(0, 0, WIDTH, HEIGHT); // fill the background

    // Use a different GradientPaint to draw a box.
    // This one alternates between deep opaque green and transparent green.
    // Note: the 4th arg to Color() constructor specifies color opacity
    g.setPaint(new GradientPaint(0, 0, new Color(0, 150, 0), 20, 20, new Color(0, 150, 0, 0), true));
    g.setStroke(new BasicStroke(15)); // use wide lines
    g.drawRect(25, 25, WIDTH - 50, HEIGHT - 50); // draw the box

    // The glyphs of fonts can be used as Shape objects, which enables
    // us to use Java2D techniques with letters Just as we would with
    // any other shape. Here we get some letter shapes to draw.
    Font font = new Font("Serif", Font.BOLD, 10); // a basic font
    Font bigfont = // a scaled up version
            font.deriveFont(AffineTransform.getScaleInstance(30.0, 30.0));
    GlyphVector gv = bigfont.createGlyphVector(g.getFontRenderContext(), "JAV");
    Shape jshape = gv.getGlyphOutline(0); // Shape of letter J
    Shape ashape = gv.getGlyphOutline(1); // Shape of letter A
    Shape vshape = gv.getGlyphOutline(2); // Shape of letter V

    // We're going to outline the letters with a 5-pixel wide line
    g.setStroke(new BasicStroke(5.0f));

    // We're going to fake shadows for the letters using the
    // following Paint and AffineTransform objects
    Paint shadowPaint = new Color(0, 0, 0, 100); // Translucent black
    AffineTransform shadowTransform = AffineTransform.getShearInstance(-1.0, 0.0); // Shear to the right
    shadowTransform.scale(1.0, 0.5); // Scale height by 1/2

    // Move to the baseline of our first letter
    g.translate(65, 270);/*  ww  w  .  jav a  2 s  .co  m*/

    // Draw the shadow of the J shape
    g.setPaint(shadowPaint);
    g.translate(15, 20); // Compensate for the descender of the J
    // transform the J into the shape of its shadow, and fill it
    g.fill(shadowTransform.createTransformedShape(jshape));
    g.translate(-15, -20); // Undo the translation above

    // Now fill the J shape with a solid (and opaque) color
    g.setPaint(Color.blue); // Fill with solid, opaque blue
    g.fill(jshape); // Fill the shape
    g.setPaint(Color.black); // Switch to solid black
    g.draw(jshape); // And draw the outline of the J

    // Now draw the A shadow
    g.translate(75, 0); // Move to the right
    g.setPaint(shadowPaint); // Set shadow color
    g.fill(shadowTransform.createTransformedShape(ashape)); // draw shadow

    // Draw the A shape using a solid transparent color
    g.setPaint(new Color(0, 255, 0, 125)); // Transparent green as paint
    g.fill(ashape); // Fill the shape
    g.setPaint(Color.black); // Switch to solid back
    g.draw(ashape); // Draw the outline

    // Move to the right and draw the shadow of the letter V
    g.translate(175, 0);
    g.setPaint(shadowPaint);
    g.fill(shadowTransform.createTransformedShape(vshape));

    // We're going to fill the next letter using a TexturePaint, which
    // repeatedly tiles an image. The first step is to obtain the image.
    // We could load it from an image file, but here we create it
    // ourselves by drawing a into an off-screen image. Note that we use
    // a GradientPaint to fill the off-screen image, so the fill pattern
    // combines features of both Paint classes.
    BufferedImage tile = // Create an image
            new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
    Graphics2D tg = tile.createGraphics(); // Get its Graphics for drawing
    tg.setColor(Color.pink);
    tg.fillRect(0, 0, 50, 50); // Fill tile background with pink
    tg.setPaint(new GradientPaint(40, 0, Color.green, // diagonal gradient
            0, 40, Color.gray)); // green to gray
    tg.fillOval(5, 5, 40, 40); // Draw a circle with this gradient

    // Use this new tile to create a TexturePaint and fill the letter V
    g.setPaint(new TexturePaint(tile, new Rectangle(0, 0, 50, 50)));
    g.fill(vshape); // Fill letter shape
    g.setPaint(Color.black); // Switch to solid black
    g.draw(vshape); // Draw outline of letter

    // Move to the right and draw the shadow of the final A
    g.translate(160, 0);
    g.setPaint(shadowPaint);
    g.fill(shadowTransform.createTransformedShape(ashape));

    g.fill(ashape); // Fill letter A
    g.setPaint(Color.black); // Revert to solid black
    g.draw(ashape); // Draw the outline of the A
}

From source file:flexflux.analyses.result.ParetoAnalysisResult.java

public void plot() {

    XYSeriesCollection dataset = new XYSeriesCollection();

    int i = 1;//w w  w. j  a  va 2 s  .com
    for (Objective obj : oneDResults.keySet()) {

        XYSeries series = new XYSeries(obj.getName());

        for (double val : oneDResults.get(obj)) {

            series.add(i, val);
        }

        dataset.addSeries(series);
        i++;
    }

    // create the chart...

    final JFreeChart chart = ChartFactory.createXYLineChart("", // chart title
            "Objectives", // x axis label
            "Values", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    ChartPanel chartPanel = new ChartPanel(chart);

    XYPlot plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.GRAY);
    plot.setDomainGridlinePaint(Color.GRAY);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setLinesVisible(false);
    renderer.setShapesVisible(true);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    JFrame frame = new JFrame("Pareto analysis one dimension results");
    frame.add(chartPanel);

    frame.pack();

    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setVisible(true);

    for (PP2DResult r : twoDResults.keySet()) {

        r.plot();

    }

    for (PP3DResult r : threeDResults.keySet()) {

        r.plot();

    }

}

From source file:com.wcmc.Software.screens.RegistrationScreen.java

@Override
public void mouseClick(MouseEvent e) {
    for (Control c : controls) {
        c.mouseClicked(e);//from w w w  .ja va  2  s . c o  m
    }
    if (!isShowingNewTools) {
        for (Control c : existingRiderControls) {
            c.mouseClicked(e);
        }
        if (btnNewRider.isClicked(e)) {
            isShowingNewTools = true;
        }
        if (!isShowingNewTools) {
            if (txtSearch.isClicked(e)) {
                if (txtSearch.getText().toString().equals("Search For Rider...")) {
                    txtSearch.setText("");
                    txtSearch.setForeColor(Color.BLACK);
                } else {
                    if (riders.getSize() > 0 && !showAutocomplete) {
                        showAutocomplete = true;
                    }
                }
            } else {
                if (riders.isClicked(e)) {
                    int riderID = riders.getRiderID(e);
                    Client.ms.rS.currentRider = riderID;
                    Client.sc.send(CONST.GET_RIDER_INFO + " " + riderID);
                    showAutocomplete = false;
                }
                if (txtSearch.getText().toString().equals("")
                        && !txtSearch.getText().equals("Search For Rider...")) {
                    txtSearch.setText("Search For Rider...");
                    txtSearch.setForeColor(Color.GRAY);
                }
                if (!riders.isClicked(e) && showAutocomplete) {
                    showAutocomplete = false;
                }
            }
            if (!showAutocomplete) {
                classes.mouseClicked(e);
                classRiders.mouseClicked(e);
            }
            rider.mouseClicked(e);
        }
    } else {
        if (btnExistingRider.isClicked(e)) {
            isShowingNewTools = false;
        }
    }
}

From source file:DrawShapes_2008.java

@Override
protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    // Paint a gradient for the sky
    GradientPaint background = new GradientPaint(0f, 0f, Color.GRAY.darker(), 0f, (float) getHeight(),
            Color.GRAY.brighter());
    g2d.setPaint(background);/*from ww  w.j  av  a  2 s .  c  o m*/
    g2d.fillRect(0, 0, getWidth(), 4 * getHeight() / 5);

    // Paint a gradient for the ground
    background = new GradientPaint(0f, (float) 4 * getHeight() / 5, Color.BLACK, 0f, (float) getHeight(),
            Color.GRAY.darker());
    g2d.setPaint(background);
    g2d.fillRect(0, 4 * getHeight() / 5, getWidth(), getHeight() / 5);

    // Enable anti-aliasing to get smooth outlines
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    // Iterate through all of the current shapes
    for (Shape shape : shapes) {
        // Get the bounds to compute the RadialGradient properties
        Rectangle rect = shape.getBounds();
        Point2D center = new Point2D.Float(rect.x + (float) rect.width / 2.0f,
                rect.y + (float) rect.height / 2.0f);
        float radius = (float) rect.width / 2.0f;
        float[] dist = { 0.1f, 0.9f };
        Color[] colors = { Color.WHITE, Color.BLACK };

        // Create and set a RadialGradient centered on the object,
        // going from white at the center to black at the edges
        RadialGradientPaint paint = new RadialGradientPaint(center, radius, dist, colors);
        g2d.setPaint(paint);

        // Finally, render our shape
        g2d.fill(shape);
    }
}