0

Situation: I have Swing-based application with several windows which needs to be displayed at a time:

  1. Main application JFrame (might be minimized, but not closed)
  2. Floating JWindow (this needs to be always visible and always on top)
  3. Appearing in some circumstances JDialog (Dialog.ModalityType.APPLICATION_MODAL). I want this dialog be modal but not always on top

I had problem with floating window - in some cases it looses it's alwaysOnTop state. I solved it by introducing timer which will update this state with true every 5 seconds.

Problem: If I show JDialog then for some reason it's alwaysOnTop status will be in sync with floating JWindow. For example if I switch to other application, this JDialog will became always on top at the same time as I update alwaysOnTop for floating window.

Question: Why is that happening and how can I get rid of it?

Thanks in advance, Sergey

Sergey Karpushin
  • 874
  • 1
  • 10
  • 33
  • be sure, nobody know, for better help sooner post an [SSCCE](http://sscce.org/), short, runnable, compilable, just about JFrame, JDIalog and JWindow, demonstrating a.m. issue, then will be very good question........, setModal, ModalityType maybe should be managed on runtime, use the same popup window, same type of, then better is managed JCOmponents hierarchy, how easilly JWindow could be un_decorated undecorated JDialog – mKorbel Apr 22 '13 at 05:44
  • Thanks for suggestion, will do it a little bit later – Sergey Karpushin Apr 22 '13 at 06:37
  • 2
    `alwaysOnTop` is actually a nightmare for the user because this goes across all applications. If you use proper `JFrame/JDialog` parenting and use appropriately the modality of `JDialog`, the user experience is highly improved and you never have issues with Frame stack. Consider also using a single `JFrame`. Check out the question [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/928711) – Guillaume Polet Apr 22 '13 at 09:08
  • Don't get me wrong, but my question is not about justifying existence of this always on top JWindow. This application really need this small floating always on top window with quick information and controls for quick access. The question is about - how to make application windows behave as expected. – Sergey Karpushin Apr 22 '13 at 19:52

0 Answers0