List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:monitor.processing.OLD.SoccerField.java
public void drawTree(BaseNode n, RealVector v) { Color c = Color.WHITE; if (n instanceof TransformNode) { v = ((TransformNode) n).getTrasformMatrix().operate(v); c = Color.ORANGE;/*w ww . j a va 2 s . c o m*/ } else if (n instanceof StaticMesh) { StaticMesh sm = (StaticMesh) n; if (sm.isTransparent()) { c = Color.BLUE; } else if (sm.isVisible()) { // System.out.println(n.getInfo()); // System.out.println(v); c = Color.RED; if (sm.getModel().contains("naohead") || sm.getModel().contains("naobody")) { c = Color.PINK; } } else { c = Color.CYAN; } } else if (n instanceof StaticMeshNode) { StaticMeshNode smn = (StaticMeshNode) n; if (smn.isTransparent()) { c = Color.GREEN; // cameraSceneX = (float)v.getEntry(0); // cameraSceneY = (float)v.getEntry(1); // cameraSceneZ = (float)v.getEntry(2); } else if (smn.isVisible()) { c = Color.YELLOW; } else { c = Color.MAGENTA; } } pushMatrix(); fill(100); // c = Color.getHSBColor(n.getAddress()*0.05f, 1, 1); stroke(c.getRed(), c.getGreen(), c.getBlue()); translate((float) (scale * v.getEntry(0)), (float) (-scale * v.getEntry(1)), (float) (scale * v.getEntry(2))); box(5); popMatrix(); for (int a = n.getChildren().size() - 1; a >= 0; a--) { drawTree(((ArrayList<BaseNode>) n.getChildren()).get(a), v); } }
From source file:org.jfree.graphics2d.demo.SVGPieChartDemo1.java
/** * Creates a chart.//from w w w . j a v a2 s. c om * * @param dataset the dataset. * * @return A chart. */ private static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title dataset); chart.removeLegend(); // set a custom background for the chart chart.setBackgroundPainter(new GradientPainter(new Color(20, 20, 20), RectangleAnchor.TOP_LEFT, Color.DARK_GRAY, RectangleAnchor.BOTTOM_RIGHT)); // customise the title position and font TextTitle t = chart.getTitle(); t.setHorizontalAlignment(HorizontalAlignment.LEFT); t.setPaint(new Color(240, 240, 240)); t.setFont(new Font("Arial", Font.BOLD, 26)); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPainter(null); plot.setInteriorGap(0.04); plot.setBorderPainter(null); // use gradients and white borders for the section colours plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE)); plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED)); plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN)); plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW)); plot.setBaseSectionOutlinePaint(Color.WHITE); plot.setSectionOutlinesVisible(true); plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f)); // customise the section label appearance plot.setLabelFont(new Font("Courier New", Font.BOLD, 20)); plot.setLabelLinkPaint(Color.WHITE); plot.setLabelLinkStroke(new BasicStroke(2.0f)); plot.setLabelOutlineStroke(null); plot.setLabelPaint(Color.WHITE); plot.setLabelBackgroundPaint(null); // add a subtitle giving the data source TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); return chart; }
From source file:org.nbheaven.sqe.codedefects.dashboard.controlcenter.panels.Statistics.java
private static JFreeChart createOverviewPanel(DefaultCategoryDataset dataSet) { JFreeChart overview = org.jfree.chart.ChartFactory.createStackedBarChart(null, null, "CodeDefects", dataSet, PlotOrientation.HORIZONTAL, false, true, false); overview.setBorderVisible(false);//w w w .ja v a 2 s . co m overview.setBackgroundPaint(Color.WHITE); overview.setAntiAlias(true); overview.setNotify(true); CategoryPlot overviewPlot = overview.getCategoryPlot(); overviewPlot.setRangeGridlinePaint(Color.BLACK); overviewPlot.setDomainGridlinePaint(Color.BLACK); overviewPlot.setBackgroundPaint(Color.WHITE); overviewPlot.setForegroundAlpha(0.7f); overviewPlot.setRangeAxisLocation(AxisLocation.getOpposite(overviewPlot.getRangeAxisLocation())); CategoryAxis domainAxis = overviewPlot.getDomainAxis(); domainAxis.setVisible(true); LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects"); rangeAxis.setLabel(null); rangeAxis.setStrictValuesFlag(false); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); overviewPlot.setRangeAxis(rangeAxis); CategoryItemRenderer categoryItemRenderer = new StackedBarRenderer(); //3D(); // categoryItemRenderers[0].setPaint(Color.RED); categoryItemRenderer.setSeriesPaint(0, Color.RED); categoryItemRenderer.setSeriesPaint(1, Color.ORANGE); categoryItemRenderer.setSeriesPaint(2, Color.YELLOW); categoryItemRenderer.setBaseItemLabelsVisible(true); overviewPlot.setRenderer(categoryItemRenderer); return overview; }
From source file:org.jfree.graphics2d.demo.CanvasBarChartDemo1.java
/** * Creates a sample chart.// ww w .j a v a 2 s. c om * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", // chart title "Type", // domain axis label "Value", // range axis label dataset); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); // customise the renderer... StatisticalBarRenderer renderer = new StatisticalBarRenderer(); renderer.setDrawBarOutline(false); renderer.setErrorIndicatorPaint(Color.black); renderer.setIncludeBaseInRange(false); plot.setRenderer(renderer); // ensure the current theme is applied to the renderer just added ChartUtilities.applyCurrentTheme(chart); renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setDefaultItemLabelsVisible(true); renderer.setDefaultItemLabelPaint(Color.yellow); renderer.setDefaultPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); // set up gradient paints for series... GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); return chart; }
From source file:CompositeEffects.java
/** Draw the example */ public void paint(Graphics g1) { Graphics2D g = (Graphics2D) g1; // fill the background g.setPaint(new Color(175, 175, 175)); g.fillRect(0, 0, getWidth(), getHeight()); // Set text attributes g.setColor(Color.black);//from w ww.j a v a 2s . c om g.setFont(new Font("SansSerif", Font.BOLD, 12)); // Draw the unmodified image g.translate(10, 10); g.drawImage(cover, 0, 0, this); g.drawString("SRC_OVER", 0, COVERHEIGHT + 15); // Draw the cover again, using AlphaComposite to make the opaque // colors of the image 50% translucent g.translate(COVERWIDTH + 10, 0); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); g.drawImage(cover, 0, 0, this); // Restore the pre-defined default Composite for the screen, so // opaque colors stay opaque. g.setComposite(AlphaComposite.SrcOver); // Label the effect g.drawString("SRC_OVER, 50%", 0, COVERHEIGHT + 15); // Now get an offscreen image to work with. In order to achieve // certain compositing effects, the drawing surface must support // transparency. Onscreen drawing surfaces cannot, so we have to do the // compositing in an offscreen image that is specially created to have // an "alpha channel", then copy the final result to the screen. BufferedImage offscreen = new BufferedImage(COVERWIDTH, COVERHEIGHT, BufferedImage.TYPE_INT_ARGB); // First, fill the image with a color gradient background that varies // left-to-right from opaque to transparent yellow Graphics2D osg = offscreen.createGraphics(); osg.setPaint(new GradientPaint(0, 0, Color.yellow, COVERWIDTH, 0, new Color(255, 255, 0, 0))); osg.fillRect(0, 0, COVERWIDTH, COVERHEIGHT); // Now copy the cover image on top of this, but use the DstOver rule // which draws it "underneath" the existing pixels, and allows the // image to show depending on the transparency of those pixels. osg.setComposite(AlphaComposite.DstOver); osg.drawImage(cover, 0, 0, this); // And display this composited image on the screen. Note that the // image is opaque and that none of the screen background shows through g.translate(COVERWIDTH + 10, 0); g.drawImage(offscreen, 0, 0, this); g.drawString("DST_OVER", 0, COVERHEIGHT + 15); // Now start over and do a new effect with the off-screen image. // First, fill the offscreen image with a new color gradient. We // don't care about the colors themselves; we just want the // translucency of the background to vary. We use opaque black to // transparent black. Note that since we've already used this offscreen // image, we set the composite to Src, we can fill the image and // ignore anything that is already there. osg.setComposite(AlphaComposite.Src); osg.setPaint(new GradientPaint(0, 0, Color.black, COVERWIDTH, COVERHEIGHT, new Color(0, 0, 0, 0))); osg.fillRect(0, 0, COVERWIDTH, COVERHEIGHT); // Now set the compositing type to SrcIn, so colors come from the // source, but translucency comes from the destination osg.setComposite(AlphaComposite.SrcIn); // Draw our loaded image into the off-screen image, compositing it. osg.drawImage(cover, 0, 0, this); // And then copy our off-screen image to the screen. Note that the // image is translucent and some of the image shows through. g.translate(COVERWIDTH + 10, 0); g.drawImage(offscreen, 0, 0, this); g.drawString("SRC_IN", 0, COVERHEIGHT + 15); // If we do the same thing but use SrcOut, then the resulting image // will have the inverted translucency values of the destination osg.setComposite(AlphaComposite.Src); osg.setPaint(new GradientPaint(0, 0, Color.black, COVERWIDTH, COVERHEIGHT, new Color(0, 0, 0, 0))); osg.fillRect(0, 0, COVERWIDTH, COVERHEIGHT); osg.setComposite(AlphaComposite.SrcOut); osg.drawImage(cover, 0, 0, this); g.translate(COVERWIDTH + 10, 0); g.drawImage(offscreen, 0, 0, this); g.drawString("SRC_OUT", 0, COVERHEIGHT + 15); // Here's a cool effect; it has nothing to do with compositing, but // uses an arbitrary shape to clip the image. It uses Area to combine // shapes into more complicated ones. g.translate(COVERWIDTH + 10, 0); Shape savedClip = g.getClip(); // Save current clipping region // Create a shape to use as the new clipping region. // Begin with an ellipse Area clip = new Area(new Ellipse2D.Float(0, 0, COVERWIDTH, COVERHEIGHT)); // Intersect with a rectangle, truncating the ellipse. clip.intersect(new Area(new Rectangle(5, 5, COVERWIDTH - 10, COVERHEIGHT - 10))); // Then subtract an ellipse from the bottom of the truncated ellipse. clip.subtract(new Area(new Ellipse2D.Float(COVERWIDTH / 2 - 40, COVERHEIGHT - 20, 80, 40))); // Use the resulting shape as the new clipping region g.clip(clip); // Then draw the image through this clipping region g.drawImage(cover, 0, 0, this); // Restore the old clipping region so we can label the effect g.setClip(savedClip); g.drawString("Clipping", 0, COVERHEIGHT + 15); }
From source file:com.google.code.facebook.graph.sna.applet.DrawnIconVertexDemo.java
public DrawnIconVertexDemo() { // create a simple graph for the demo graph = new DirectedSparseGraph<Integer, Number>(); Integer[] v = createVertices(10); createEdges(v);//from w w w .j av a 2 s. co m vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph)); vv.getRenderContext().setVertexLabelTransformer(new Transformer<Integer, String>() { public String transform(Integer v) { return "Vertex " + v; } }); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); vv.getRenderContext().setVertexIconTransformer(new Transformer<Integer, Icon>() { /* * Implements the Icon interface to draw an Icon with background color and * a text label */ public Icon transform(final Integer v) { return new Icon() { public int getIconHeight() { return 20; } public int getIconWidth() { return 20; } public void paintIcon(Component c, Graphics g, int x, int y) { if (vv.getPickedVertexState().isPicked(v)) { g.setColor(Color.yellow); } else { g.setColor(Color.red); } g.fillOval(x, y, 20, 20); if (vv.getPickedVertexState().isPicked(v)) { g.setColor(Color.black); } else { g.setColor(Color.white); } g.drawString("" + v, x + 6, y + 15); } }; } }); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray)); vv.setBackground(Color.white); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:org.jfree.expdemo.SelectionDemo3.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);/*from ww w .jav a 2s . co m*/ plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); //XYItemRenderer r = plot.getRenderer(); XYDotRenderer r = new XYDotRenderer(); r.setDotHeight(2); r.setDotWidth(2); r.setSeriesPaint(0, Color.blue); r.setSeriesPaint(1, Color.green); r.setSeriesPaint(2, Color.yellow); r.setSeriesPaint(3, Color.orange); plot.setRenderer(r); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickCount(2); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickCount(2); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemPaint(r, ext, Color.red); //register plot as selection change listener ext.addSelectionChangeListener(plot); return chart; }
From source file:edu.uci.ics.jung.samples.DrawnIconVertexDemo.java
@SuppressWarnings("unchecked") public DrawnIconVertexDemo() { // create a simple graph for the demo graph = new DirectedSparseGraph<Integer, Number>(); Integer[] v = createVertices(10); createEdges(v);/*w w w . ja v a 2s . c o m*/ vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph)); vv.getRenderContext().setVertexLabelTransformer(new Transformer<Integer, String>() { public String transform(Integer v) { return "Vertex " + v; } }); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); vv.getRenderContext().setVertexIconTransformer(new Transformer<Integer, Icon>() { /* * Implements the Icon interface to draw an Icon with background color and * a text label */ public Icon transform(final Integer v) { return new Icon() { public int getIconHeight() { return 20; } public int getIconWidth() { return 20; } public void paintIcon(Component c, Graphics g, int x, int y) { if (vv.getPickedVertexState().isPicked(v)) { g.setColor(Color.yellow); } else { g.setColor(Color.red); } g.fillOval(x, y, 20, 20); if (vv.getPickedVertexState().isPicked(v)) { g.setColor(Color.black); } else { g.setColor(Color.white); } g.drawString("" + v, x + 6, y + 15); } }; } }); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray)); vv.setBackground(Color.white); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:temp1.RealTimeChart.java
public static JFreeChart createChart(String chartContent, String title, String yaxisName) { thread1 = new Thread(); timeseries1 = new TimeSeries(chartContent, Millisecond.class); timeseries2 = new TimeSeries(chartContent, Millisecond.class); timeseries3 = new TimeSeries(chartContent, Millisecond.class); timeseries4 = new TimeSeries(chartContent, Millisecond.class); TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries1); TimeSeriesCollection timeseriescollection1 = new TimeSeriesCollection(timeseries2); TimeSeriesCollection timeseriescollection2 = new TimeSeriesCollection(timeseries3); TimeSeriesCollection timeseriescollection3 = new TimeSeriesCollection(timeseries4); jfreechart = ChartFactory.createTimeSeriesChart("", "", "", timeseriescollection, false, false, false); final XYPlot xyplot = jfreechart.getXYPlot(); xyplot.setOutlinePaint(Color.magenta); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.gray); xyplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); ValueAxis valueaxis = xyplot.getDomainAxis(); valueaxis.setAutoRange(true);//from w w w . java2 s. co m valueaxis.setFixedAutoRange(20000D); //Value valueaxis = xyplot.getRangeAxis(); valueaxis.setRange(800D, 3300D); xyplot.setDataset(0, timeseriescollection); xyplot.setDataset(1, timeseriescollection1); xyplot.setDataset(2, timeseriescollection2); xyplot.setDataset(3, timeseriescollection3); XYLineAndShapeRenderer xylineandshaperenderer0 = new XYLineAndShapeRenderer(); XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer(); XYLineAndShapeRenderer xylineandshaperenderer2 = new XYLineAndShapeRenderer(); XYLineAndShapeRenderer xylineandshaperenderer3 = new XYLineAndShapeRenderer(); xylineandshaperenderer0.setBaseShapesVisible(false); xylineandshaperenderer1.setBaseShapesVisible(false); xylineandshaperenderer2.setBaseShapesVisible(false); xylineandshaperenderer3.setBaseShapesVisible(false); xylineandshaperenderer0.setSeriesPaint(0, Color.RED); xylineandshaperenderer1.setSeriesPaint(0, Color.cyan); xylineandshaperenderer2.setSeriesPaint(0, Color.yellow); xylineandshaperenderer3.setSeriesPaint(0, Color.blue); xyplot.setRenderer(0, xylineandshaperenderer0); xyplot.setRenderer(1, xylineandshaperenderer1); xyplot.setRenderer(2, xylineandshaperenderer2); xyplot.setRenderer(3, xylineandshaperenderer3); //xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.5F, 1, 1, 5F, new float[] { 5F, 10F }, 0.0F)); return jfreechart; }
From source file:Pear.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Dimension d = getSize();/* w w w . j av a 2 s . c o m*/ int w = d.width; int h = d.height; double ew = w / 2; double eh = h / 2; g2.setColor(Color.green); // Creates the first leaf by filling the intersection of two Area objects // created from an ellipse. leaf.setFrame(ew - 16, eh - 29, 15.0, 15.0); leaf1 = new Area(leaf); leaf.setFrame(ew - 14, eh - 47, 30.0, 30.0); leaf2 = new Area(leaf); leaf1.intersect(leaf2); g2.fill(leaf1); // Creates the second leaf. leaf.setFrame(ew + 1, eh - 29, 15.0, 15.0); leaf1 = new Area(leaf); leaf2.intersect(leaf1); g2.fill(leaf2); g2.setColor(Color.black); // Creates the stem by filling the Area resulting from the subtraction of // two Area objects created from an ellipse. stem.setFrame(ew, eh - 42, 40.0, 40.0); st1 = new Area(stem); stem.setFrame(ew + 3, eh - 47, 50.0, 50.0); st2 = new Area(stem); st1.subtract(st2); g2.fill(st1); g2.setColor(Color.yellow); // Creates the pear itself by filling the Area resulting from the union of // two Area objects created by two different ellipses. circle.setFrame(ew - 25, eh, 50.0, 50.0); oval.setFrame(ew - 19, eh - 20, 40.0, 70.0); circ = new Area(circle); ov = new Area(oval); circ.add(ov); g2.fill(circ); }