日期:2014-05-20 浏览次数:20690 次
import java.awt.Graphics; import javax.swing.JPanel; public class RepaintDemo { public static void main(String args[]) { GamePanel gamepanel = new GamePanel(); gamepanel.display(); } } class GamePanel extends JPanel { public void display() { System.out.println("GamePanel's display!"); this.repaint(); } protected void printComponent(Graphics g) { // TODO Auto-generated method stub System.out.println("GamePanel's PrintComponent"); } }