package elte.java2_utikalauz5.java2d; import java.awt.*; import java.awt.event.*; /** peldaprogram a GradientPaint hasznalatara. @link.forrásfájl {@docRoot}/../data/java2d/src Szinatmenet.java @link.letöltés {@docRoot}/../data/java2d Szinatmenet.jar @since Java 2 Útikalauz programozóknak */ class Szinatmenet extends Canvas { /** Verziószám */ private final static long serialVersionUID = 15L; public void paint (Graphics g) { Graphics2D g2 = (Graphics2D) g; GradientPaint gp = new GradientPaint (10.0f, 10.0f, Color.red, 50.0f, 200.0f, Color.white); g2.setPaint (gp); g2.fillRect (10, 10, 150, 200); } public static void main (String[] args) { Frame f = new Frame (); f.add (new Szinatmenet ()); f.addWindowListener ( new WindowAdapter () { public void windowClosing (WindowEvent e) { System.exit (0); } } ); f.setSize (300, 300); f.setVisible (true); } }