首页 > 其他 > 详细

点点点系列最少的程序架构

时间:2016-07-04 12:02:42      阅读:256      评论:0      收藏:0      [点我收藏+]
import java.awt.*; 
import java.util.*;    
import java.awt.event.*;   
import javax.swing.JPanel;
public class Main extends JPanel {
	static Point p = null;	 
	public static Frame frame = new Frame();
	public static void main(String[] args) {
		Main f = new Main();
		frame.setTitle("【点点点】");
		frame.add(f);		 
		frame.setSize(500, 500);
		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
		frame.addMouseListener(new MouseAdapter() {			 
			public void mouseClicked(MouseEvent e) {
				 p = new Point(e.getX(), e.getY());
			 	 frame.repaint();
			}
		});
		frame.setVisible(true);
	}  
	public void paint(Graphics g) {  
	g.drawString(p.getX() + " " + p.getY(),(int)p.getY(),(int)p.getY());			
		}	 
	}

主要由3部分构成   而还有一系列游戏需要不断刷屏  下一篇给出 带timmer的代码

点点点系列最少的程序架构

原文:http://wzsts.blog.51cto.com/10251779/1795521

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!