怎么调用它呀,是用对像加点直接调用 吗??请高手解答!!!
//举个例子 [CODE] import java.awt.*; import javax.swing.*; public class LinePaint extends JFrame { // set window's titil bar String and dimensions public LinePaint() { super("Drawing Line"); setSize(400,300); setVisible(true); } public void paint(Graphics g) { super.paint(g); //call superclass's paint method g.setColor(Color.RED); g.drawLine(5, 50,350,50);
g.setColor(Color.BLUE); g.drawRect(5,70,90,55); g.fillRect(100,70,90,55); } //end method paint //execute application public static void main(String [] args) { LinePaint application = new LinePaint(); application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }//end class LinePaint [/CODE]
[此贴子已经被作者于2005-10-16 12:19:35编辑过]