标签:小代码
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