Stop a jframe requesting focus
I have a small application that updates the 开发者_运维知识库contents of a JFrame very quickly (many times per second) and on each update (I remove a component and then add a new one, then set visibility true again) the JFrame flashes on the Taskbar (WinXp) to request focus. It's very annoying and I'm sure it can be disabled. I just cant find out where.
Any ideas?
Am I understanding you correctly
You do something like
frame.remove(cold);
frame.add(cnew);
frame.setVisible(false);
frame.setVisible(true);
Instead of doing this try using
frame.remove(cold);
frame.add(cnew);
frame.validate()
I remove a component and then add a new one,
The better solution would be to simply update the existing component. Swing components are designed to repaint themselfs when there properties and data are changed.
精彩评论