首页>代码>java swing开发GUI射击小游戏一枚>/NewGame/src/com/leng/frame/TheCharts.java
/**
 * 
 */
package com.leng.frame;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.util.List;

import javax.swing.JFrame;

import com.leng.IO.SortBean;
import com.leng.IO.SortDao;
import com.leng.Util.InitImage;
import com.leng.Util.MyMouseListener;

/**
 * ������
  @author ���������š���Ϸ��ɢ����
 * 2013-8-26
 */
public class TheCharts  extends JFrame implements Runnable{
	
/**
 * ý��׷����
 */
public	MediaTracker  track;
/**˫���廭��*/
private Image memoryImage;
/**˫���廭��*/
private Graphics memoryGraphics;
/**��������**/
SortDao st=new SortDao();
/**���ܲ�ѯ�����**/
List<SortBean> list;
/**��ʼ���Ʒ���� x**/
  private int x=160;
/**��ʼ���Ʒ���� y**/
  private int y=50;
	/**
	 * ͨ�سɹ��Ļ���
	 * */
	public static Image overImage;
	/**�˳���ť��ͼƬ**/
	public static Image  tuichu;
	/**���а��Ƿ�����**/
	public static boolean isStart=true;

	public TheCharts() {
		super("���а�");
		//���ô����С
		this.setSize(900, 700);
		//���ùر�  ����رճ������
		this.setDefaultCloseOperation(3);
		//�������
		this.setLocationRelativeTo(null); 
		//�����С�����Ա��ı�
		this.setResizable(false);
		//���ô���ɼ�
		this.setVisible(true);
		/**
		 * ˫���廭���ͻ��ʵij�ʼ��
		 */
		/**900*700���ڴ滭��*/
		this.memoryImage=this.createImage(900,700);
		/**�ڴ滭��*/
		this.memoryGraphics=this.memoryImage.getGraphics();
		/**���û�����ɫ*/
		memoryGraphics.setColor(Color.red);
		/**���������С*/
		memoryGraphics.setFont(new Font("����",Font.BOLD,25));
		/**
		 * ý��׷����
		 */
		 track=new MediaTracker(this);
		 /**��Ӽ�����  ���û�����˳�ͼƬ��ʱ�򷵻���Ϸ��ʼ�Ľ���**/
		 this.addMouseListener(new MyMouseListener());
		 /**��ʼ�� ��Ϸ����ͼƬ*/
		 InitImage.inOver(track);
		 /**��ѯ���а�**/
		 list=st.getlist();
		 
	}
	/**������Ϸʧ�ܵĻ���**/
	private void draw(Graphics g){
		memoryGraphics.drawImage(overImage, 0,0,900,700,null);
		memoryGraphics.drawImage(this.tuichu, 800,640,70,40,null);
		y=130;
		memoryGraphics.drawString("���"+"           "+"ս��", 190, 120);
		for(int i=0;i<5;i++){
			y+=60;
			memoryGraphics.drawString(i+1+" "+list.get(i).getName(), x, y);
			memoryGraphics.drawString(list.get(i).getPointer()+"", 390, y);
		}
		g.drawImage(this.memoryImage, 0,0,this);
		}
	@Override
	public void run() {
		while(isStart){
			this.draw(this.getGraphics());
		}
		this.dispose();
	}
	public static void main(String[] args) {
		 
	}
}
最近下载更多
wzy5432  LV1 2023年4月18日
huangzy  LV12 2023年4月6日
总有人间一两风  LV8 2022年12月12日
一头土猪  LV7 2021年12月22日
zhanghe001  LV9 2021年12月18日
选了了  LV7 2021年12月13日
my1999  LV2 2021年11月27日
tangjj7260  LV18 2021年11月20日
pipichao  LV6 2021年6月20日
ldx1234  LV4 2021年5月17日
最近浏览更多
dushine  LV3 4月14日
微信网友_7289626841501696  LV3 2024年12月17日
interface  LV22 2024年8月10日
wppppp  LV3 2024年6月4日
bangyiyang  LV2 2023年12月21日
wsgwly  LV6 2023年9月11日
1441854423  LV2 2023年6月30日
1614076596  LV1 2023年5月22日
flygrass  LV12 2023年4月24日
wzy5432  LV1 2023年4月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友