怎样可以使一个全屏的JFrame界面显示在最前端。不要告诉我用setAlwaysOnTop这个最前端是指不能用ALT+TAB进行切换,一直处于最前端。我尝试过去捕获这个组合键,让ALT+TAB组合键做另的事情,但是没有达到我想要的效果。我记得我以前有写过这东西,也是在网上看来的,但是现在找不到了。我记得好像几句话就搞定了。希望高手们拔刀相助!!~~

解决方案 »

  1.   

    windows本身的快捷键能屏蔽吗 我想只能是强制使找个界面处于显示状态才可以吧  setalwaysontop方法还是可以用的吧      在添加fouslistener强制获得焦点不可以吗  我去学习下这个东西:(
      

  2.   

    I hope the code as follow is your requrired!In full-screen mode, no window can overlap the full-screen window. Also, when in full-screen mode, the display mode typically can be changed if desired (see e605 Setting the Screen Size, Refresh Rate, or Number of Colors). 
        // Determine if full-screen mode is supported directly
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gs = ge.getDefaultScreenDevice();
        if (gs.isFullScreenSupported()) {
            // Full-screen mode is supported
        } else {
            // Full-screen mode will be simulated
        }
        
        // Create a button that leaves full-screen mode
        Button btn = new Button("OK");
        btn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                // Return to normal windowed mode
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                GraphicsDevice gs = ge.getDefaultScreenDevice();
                gs.setFullScreenWindow(null);
            }
        });
        
        // Create a window for full-screen mode; add a button to leave full-screen mode
        Frame frame = new Frame(gs.getDefaultConfiguration());
        Window win = new Window(frame);
        win.add(btn, BorderLayout.CENTER);
        
        try {
            // Enter full-screen mode
            gs.setFullScreenWindow(win);
            win.validate();
        
            // ...
        } finally {
            // Exit full-screen mode
            gs.setFullScreenWindow(null);
        }