package elte.java2_utikalauz5.java2d; import java.awt.*; import java.awt.geom.*; import java.awt.event.*; /** peldaprogram a boolean-muveletek hasznalatat mutatja be. @link.forrásfájl {@docRoot}/../data/java2d/src CAG.java @link.letöltés {@docRoot}/../data/java2d CAG.jar @since Java 2 Útikalauz programozóknak */ class CAG extends Canvas { /** Verziószám */ private final static long serialVersionUID = 15L; public void paint (Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D kor1 = new Ellipse2D.Float (10.0f, 10.0f, 150.0f, 150.0f); Ellipse2D kor2 = new Ellipse2D.Float (100.0f, 10.0f, 250.0f, 150.0f); Area kulonbseg = new Area (kor1); kulonbseg.subtract (new Area (kor2)); g2.setColor (Color.blue); g2.fill (kulonbseg); } public static void main (String[] args) { Frame f = new Frame (); f.add (new CAG ()); f.addWindowListener ( new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0); } } ); f.setSize (300, 300); f.setVisible (true); } }