title: Blink jframe in swing without transferring focus
body: <p>I want to blink my jframe's entry in taskbar but do not want it to get focused. I read about in on net and tried different solutions but none of them worked for me.</p>
  
  <p>In my case I have a main jframe which has 2 buttons on click of which 2 jframes are opened. Both jframe listens to some event messages and on receiving of message it should blink if not focused.</p>
  
  <p>I have tried following:</p>
  
  <ol>
  <li><code>frame.toFront();</code></li>
  <li><code>frame.requestFocus();</code></li>
  <li><code>frame.firePropertyChange();</code></li>
  <li><code>frame.setVisible(true);</code></li>
  </ol>
  
  <p>They all worked well in blinking windows but the focus also gets transfered to that window which I don't want it do. How can I stop focus transfer? I have also tried calling <code>transferFocus();</code> after the above options but didn't worked.</p>
  
  <p>I have searched on SO but didn't find the solution. The questions I found are </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/489255/using-swing-how-can-i-flash-the-windows-taskbar">How can I flash the Windows taskbar using Swing?</a></li>
  <li><a href="https://stackoverflow.com/questions/4023281/jframe-to-be-displayed-when-the-event-occurs">JFrame to be displayed when the event occurs?</a></li>
  </ul>
  
  <hr>
  
  <p>My current code:-</p>
  
  <pre><code>public void OnEvent(){
      Toolkit.getDefaultToolkit().beep();  
      if(!hasFocus()){
           toFront(); //requestFocus(); //setVisible(true); //firePropertyChange("",false,true);
      }
  }
  </code></pre>