I have the code below. There is one thing I can't understand.If I execute this
code, the methode public void paint(...) is executed eventhough it is not called
in the main method. Can anyone tell me why?
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
class First2DDemo extends JFrame {
public void paint( Graphics g ) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.draw( new Line2D.Double( 20, 30, 90, 70 ) );
}
public static void main( String args[] ) {
JFrame f = new First2DDemo();
f.setSize( 100, 100 );
f.show();
}
}