尝试使用此类的方法
Window:
Window.setAlwaysOnTop(boolean)
它的工作方式与Windows TaskManager中的默认工作方式相同:切换到另一个应用程序,但始终显示在最前面。
这是在Java 1.5中添加的
样例代码:
import javax.swing.Jframe;import javax.swing.JLabel;public class Annoying { public static void main(String[] args) { Jframe frame = new Jframe("Hello!!"); // Set's the window to be "always on top" frame.setAlwaysonTop( true ); frame.setLocationByPlatform( true ); frame.add( new JLabel(" Isn't this annoying?") ); frame.pack(); frame.setVisible( true ); }}


