posted 15 years ago
Hi all,
I have a JButton on a JDialog (and a lot of other components too) that can minimize that dialog to the System Tray.
When the JDialog is made visible again from the System Tray, I want to set the focus back to the component on the JDialog that had the focus before the 'minimize to tray' JButton was pressed (which may be any of the components on that dialog).
Is their a handy way of doing this? I looked through the Swing API for a suitable method but I did not find anything. I guess I could implement the focus lost event for every single component on the JDialog, but that seems a bit of an overkill. For now, I just set the focus to a specific component, but I want to make the dialog a bit more user friendly.
Any help would be appreciated, thanks,
Willem.
I may have answered my on question. I checked the FocusEvent class, which has a method getOppositeComponent() which seems to do what I need.
Cheers,
Willem.