while(true){
   this.toFront() ;
}

解决方案 »

  1.   

    Make a Window "stay on top"
    First you need the handle of the Window. Call this JNI function with Window Title. JNIEXPORT jint JNICALL Java_JavaHowTo_getHwnd(JNIEnv *env, jclass obj, jstring title){
     HWND hwnd = NULL;
     const char *str = NULL; str = (*env)->GetStringUTFChars(env, title, 0);
     hwnd = FindWindow(NULL,str);
     (*env)->ReleaseStringUTFChars(env, title, str);
     return (jint) hwnd;
     } 
    Then you pass the handle to this function JNIEXPORT void JNICALL Java_JavaHowTo_setWindowAlwaysOnTop(JNIEnv *env, jclass obj, jint hwnd, jboolean flag){
     if (flag)
        SetWindowPos((HWND) hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
     else
        SetWindowPos((HWND) hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
     return;

      

  2.   

    谢谢lner,那你知道如何全屏显示一个frame吗?路人甲老大你写的什么东东?我是说java如何实现,你怎么?是我太笨了?
      

  3.   

    另外请问lner的方法需要一个线程来控制吧?
      

  4.   

    int w = Toolkit.getDefaultToolkit().getScreenSize().width ;
    int h = Toolkit.getDefaultToolkit().getScreenSize().height;
    this.setSize(w,h);
      

  5.   

    public class frmFrame extends Frame implements Runnable{  private Thread m_thread = null ;
      void init(){
        m_thread = new Thread(this);
        m_thread.start();
      }
      public void run(){
       //...
       while(true){
         this.toFront() ;
        //...
       }
       //...
      }
    }