当前位置: 代码迷 >> J2SE >> 谁知道swing任务栏闪动如何做
  详细解决方案

谁知道swing任务栏闪动如何做

热度:48   发布时间:2016-04-24 02:03:54.0
哪位高手知道swing任务栏闪动怎么做
哪位高手知道swing任务栏闪动怎么做,就好像QQ收到消息后,任务栏变成黄色闪动,麻烦大家回答具体点

------解决方案--------------------
你还是使用C#/C++/VB之类的开发这种需求的程序吧。
------解决方案--------------------
从网上找到的。

Java code
 ** * 原理就是当Iframe不是焦点时,<br> * 使用setVisible(true)对他再次显示<br> * 就会有闪烁效果 * @author 飞雪无情 * */public class JFrameTest {    private JFrame frame = null;     public JFrameTest() {         frame = new JFrame("Test");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        frame.setSize(400, 300);        frame.setVisible(true);        try {             // 这里等待3秒钟,你打开其程序,            //主要目的是使frame不是当前的聚焦窗体            Thread.sleep(3000);        }catch (InterruptedException e1){             e1.printStackTrace();        }         frame.setVisible(true);    }    /**     * @param args     */    public static void main(String[] args) {        new JFrameTest();    }}
------解决方案--------------------
Java code
    /**     * Flashes the specified window. It does not change the active state of the     * window.     *      * @param hwnd     *            specified window handle.     * @param flash     *            whether flash the window.     * @return return true if do the operation successfully, else return false.     *      */    public static boolean flashWindow( int hwnd, boolean flash )    {        FLASHWINFO flashInfo = new FLASHWINFO( );        if ( flash )            flashInfo.dwFlags = FLASHWINFO.FLASHW_ALL | FLASHWINFO.FLASHW_TIMER;        flashInfo.hwnd = hwnd;        return Extension.FlashWindowEx( flashInfo );    }