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

class test_jpanel extends JPanel
{
    public test_jpanel ()
    {
	super.setBackground( Color.yellow );
    }

    public void paintComponent(Graphics g)
    {
	super.paintComponent(g);

	g.setColor(Color.magenta);
	g.draw3DRect( 15, 15, 200, 15, true );
	g.setColor(Color.blue);
	g.draw3DRect(15,100, 300, 30, false);
	g.setColor(Color.green);
	g.setFont(new Font("Serif", Font.BOLD, 12));
	g.drawString("Serif 12 point bold.", 20, 50);
	
	g.setFont( new Font("Monospaced", Font.ITALIC, 24) );
	g.drawString("Monospaced 24 point italic.", 20, 100);
	
	g.setFont( new Font("Symbol", Font.PLAIN, 18) );
	g.drawString( "Symbol 18 point plain.", 20, 200 );
    }
}

class Fonts extends JFrame
{
    public Fonts()
    {
	setTitle("ShowFonts");
	setSize(500,400);
	setLocation(200,200);
	Container cp = getContentPane();
	cp.add(new test_jpanel() );
    }
}

public class Use_JPanel
{
    public static void main ( String []args )
    {
	JFrame jf = new Fonts();
	jf.setVisible(true);
    }
}

