Post by Tobias VogelePost by Andre Teubner[API]
...No action will take place if this Window is not visible...
[/API]
Ergo, wenn richtig im Hintergrund ist Schicht im Schacht.
"not visible" würde ich so verstehen, daß das Fenster noch nicht mit
show() oder setVisible(true) geöffnet wurde bzw. bereits analog
geschlossen wurde.
Dann ist es aber eben geschlossen und nicht im Hintergrund. IHMO gibt es
kein "richtig" oder "falsch" im Hintergrund. Wenn toFront() manchmal
nicht funktioniert, obwohl das Fenster noch da ist (also etwa einen
Button in der Taskleiste hat), ist das IMO ein Bug.
Auzug aus der API (diesmal etwas mehr):
Places this Window at the top of the stacking order and shows it in front
of any other Windows in this VM. No action will take place if this Window is
not visible. Some platforms do not allow Windows which own other Windows to
appear on top of those owned Windows. Some platforms may not permit this VM
to place its Windows above windows of native applications, or Windows of
other VMs. This permission may depend on whether a Window in this VM is
already focused. Every attempt will be made to move this Window as high as
possible in the stacking order; however, developers should not assume that
this method will move this Window above all other windows in every
situation.
Insbesondere der letzte Satz läßt vermuten, daß es eben schon dazu kommen
kann, daß toFront() nicht funktioniert. Also ist toFront() kein
zuverlässiger weg.
Gruß,
Daniel