Fill a solid three-dimensional rectangle : Graphics « 2D Graphics « Java Tutorial

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainClass extends JPanel {

  public static void main(String[] a) {
    JFrame f = new JFrame();
    f.setSize(400, 400);
    f.add(new MainClass());

  public void paint(Graphics g) {
    g.setColor (Color.yellow);  
    g.fill3DRect (5, 15, 50, 75, true); 

16.2.1.Draw rectangles
16.2.2.Fill a solid three-dimensional rectangle
16.2.3.Draw Ellipses
16.2.4.Draw 2D shapeDraw 2D shape
16.2.5.Draw Arcs
16.2.6.Draw PolygonDraw Polygon
16.2.7.Resizing output to fit the current size of a window.
16.2.8.Demonstrate XOR mode.Demonstrate XOR mode.