import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;

public class Renk2D extends JApplet {
   
    private int kirmizi,yesil,mavi; 
   
    public void init() 
    {
        kirmizi=100;
        yesil=255;
        mavi=125; 
        setBackground(new Color(0,0,255));
        setForeground(new Color(kirmizi,yesil,mavi));
    }

   
    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;       
        g2.setPaint(new Color(kirmizi,yesil,mavi));
        g2.drawString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",50,33); 
        g2.drawString("Su andaki renk : "+g2.getColor(),50,53); 
    }

    public static void main(String s[]) {
        JFrame f = new JFrame("Renk2D");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        JApplet applet = new Renk2D();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(350,100));
        f.show();
    }

}
