最近玩穿越火线  想练习盲狙 但是毕竟不能 在屏幕上画个点啊  好好的液晶 浪费啊 
     所以想写个程序   帮忙在屏幕中间绘制出一个点 并且前段显示
     不知道怎么实现 高手能不能帮忙 列出用到的一些个类 什么的 
     我自己来写就可以了

解决方案 »

  1.   

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Window;
    public class ScreenCenter {
        public static final int WIDTH = 5 ;
        public static final int HEIGHT = 5 ;
    /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
     
    Window window = new Window(null);
            window.setBounds((getScreenWidth()-WIDTH)/2, (getScreenHeight()-HEIGHT)/2, WIDTH, HEIGHT);
            window.setBackground(Color.red);
            window.setVisible(true);
    }
    /**
     * 得到屏幕的宽度
     * @return
     */
    public static int getScreenWidth(){
         Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
         return (int)dim.getWidth();
        }
    /**
     * 得到屏幕的高度
     * @return
     */
        public static int getScreenHeight(){
         Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
         return (int)dim.getHeight();
        } 
    }问题是怎么让 这个 window 始终在前段显示  显示在穿越火线 游戏之前
      

  2.   

    window.setAlwaysOnTop(true);  
    这个只能  在普通窗口的前段显示 我试过了 
    但是不能在游戏  前段显示 怎么解决
      

  3.   

    while(true){
    Thread.sleep(50);    
    window.toFront();
             }
    }加上这样一段代码后  能正常显示 
    但是  游戏会提示我发现 非法模块然后把我T 出去