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.
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.
I have tried following:
frame.toFront();
frame.requestFocus();
frame.firePropertyChange();
frame.setVisible(true);
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 transferFocus();
after the above options but didn't worked.
I have searched on SO but didn't find the solution. The questions I found are
My current code:-
public void OnEvent(){
Toolkit.getDefaultToolkit().beep();
if(!hasFocus()){
toFront(); //requestFocus(); //setVisible(true); //firePropertyChange("",false,true);
}
}