import java.awt.*;import javax.swing.*;
import java.io.*;
import java.awt.event.*;
import java.awt.image.MemoryImageSource;class H1 extends JFrame implements ActionListener
{
private int a;
private static final long serialVersionUID = -7318514688915584864L;
public H1()
    {
     setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
     setBounds(200,50,700,600);
Container frameContainer = getContentPane();
     setLayout(null);
    
    
    
    
     setVisible(true);
    }

public void setA(int a)
{
this.a = a;
}
public int getA()
{
return this.a;
} public void actionPerformed(ActionEvent e)
{
//输入响应ActionEvent操作
}
public void paint(Graphics g)
{
// super.paint(g);
        int w = 300;
        int h = 300;
        int pix[] = new int[w * h];
        int index = 0;
        for (int y = 0; y < h; y++) {
            int red = (y * 255) / (h - 1);
            for (int x = 0; x < w; x++) {
                int blue = (x * 255) / (w - 1);
                pix[index++] = (255 << 24) | (red << 16) | blue;
            }
        }
        Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
        System.out.println(img.getClass());  //为什么多次输出。按理说应该执行一次。
g.drawImage(img, w, h, this);
}

public static void main(String args[])
{
H1 de = new H1();
}
}