一个不明白的函数
import java.awt.*;import javax.swing.*;
public class ShowImage extends JFrame
{
public ShowImage()
{
setSize(300,400);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
repaint(); //这里为什么用的是repaint()啊,为什么不是paint()
}
public void paint(Graphics g)
{
g.drawLine(20,20,260,250);
}
public static void main(String args[])
{
new ShowImage();
}
}