Java面向对象编程(随书配套源代码) 阐述了面向对象编程的思想

源代码在线查看: example1.java

软件大小: 402 K
上传用户: BEIJINGHUANYING
关键词: Java 对象 编程 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				package chapter15;
				
				import javax.swing.*;
				import java.awt.*;
				
				public class example1 extends JApplet 
				{
					int initCounter=0;
					int startCounter=0;
					int stopCounter=0;
					int destroyCounter=0;
					
					public void paint(Graphics g)
					{
						g.drawString("init    : "+initCounter, 20, 20);
						g.drawString("start   : "+initCounter, 20, 35);
						g.drawString("stop    : "+initCounter, 20, 50);
						g.drawString("destroy : "+initCounter, 20, 65);
					}
					
					public void init()
					{
						initCounter++;
						repaint();
					}
					
					public void start()
					{
						startCounter++;
						repaint();
					}
					
					public void stop()
					{
						stopCounter++;
						repaint();
					}
					
					public void destroy()
					{
						destroyCounter++;
						repaint();
					}
				}
							

相关资源