-2

I'm developing a somewhat complex app with javaFx and I'm facing a technical decision concerning popups (tooltips, context menus, alerts... etc), it seems like I have two approaches to go about it:

  1. extend PopupWindow (or PopupControl), the popups will be rendering outside the application in their own undecorated window.
  2. wrap my whole app in a parent that supports fixed/absolute positioning and show/position popups as overplayed nodes.

I know this seems a bit opinion based but i just can't find any resources on it, if anyone done some profiling or a performance comparison, and I don't know which one is "best-practice" for a desktop application.

It intuitively seems like the window popup approach is favoured and easier to implement but I've seen real applications like messenger and discord using the second approach (maybe because they're using electron and they're obliged to follow "the web way" of doing things).

any help would be appreciated.

UPDATE

I'm back to add my input on this question after trying to implement the ideas, just in case anyone comes by this question with the same issues.

both approaches come with limitations and I came across the following issues :

Tooltips blocking mouse events

If you build your tooltip system around PopupControl (or PopupWindow) and you want your tooltips to have a shadow around them, the tooltip (or the shadow) will block the mouse events from reaching the nodes in the application window, and because you can't make the window transparent to mouse events, it would cause some flickering (you hover a node, tooltip shows then steals mouse events which causes a MouseExited event on the node, which causes the tooltip to hide, and it happens endlessly unless you move the mouse away)

before the fix

This issue is essentially caused by the shadow, building your tooltips around a layout (VBox, for instance) and adding to tooltip to the root of the scene will solve this issue, because you can simply make the tooltip mouse transparent.

After the fix

Popups having to show outside the application window

in some situations you may have a popup/context menu that has a somewhat fixed position, say it has to show under a specific node and it can't be re-positioned inside the application window, if you build your context menus around a layout that gets added to the scene root, your context menus might have to clip at some places.

before the fix

This issue is naturally solved if your popups are based on PopupControl or PopupWindow.

after the fix

SDIDSA
  • 894
  • 10
  • 19
  • 2
    Don't overlook the corresponding [debate](https://stackoverflow.com/q/9554636/230513) among designers using a related GUI. – trashgod Oct 26 '21 at 00:08
  • 1
    Part of it depends if you want a web-like interface or not. If you want it web-like, then you have navigation menus on every screen, support forward/back buttons, and make everything behave a lot like a web browser. It is what a lot of people are used to nowadays. It may not be the best way to do it but it is familiar. Also, the target device is a consideration, mobile UIs are often different than desktop ones. – jewelsea Oct 26 '21 at 01:07
  • 1
    In terms of a "non-web" interface, if they are just single application modal pop-ups as overlays for editing a value in a table, that is easy enough. But if you want a [Multiple-document Interface (MDI)](https://en.wikipedia.org/wiki/Multiple-document_interface) there is no native support for that in JavaFX. You could build it, but it would be quite some work. – jewelsea Oct 26 '21 at 01:10
  • 1
    If it is a Windows app, or you would like it to look like one (no matter the platform), then you could attempt to follow the [Microsoft app design guideline](https://learn.microsoft.com/en-us/windows/apps/design/). Similarly, Google has its guideline for [material](https://material.io/design/guidelines-overview). And Apple has its [Human Interface Guidelines for Mac and iOS](https://developer.apple.com/design/human-interface-guidelines). – jewelsea Oct 26 '21 at 01:17
  • 1
    So really, just take your pick, study as much as you want, then use or ignore whatever you want and come up with a nice design for your app that you would want to use and would work well for users, following [12 Do you do hallway usability testing?](https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/) Eventually, the question will undoubtedly be closed as "likely to lead to opinion-based answers." – jewelsea Oct 26 '21 at 01:17
  • very useful hints and links, thank you so much – SDIDSA Oct 26 '21 at 02:02

1 Answers1

1

Though window popup approach sounds good and easy I have encountered the below two issues with that approach. Just letting you know if you need to consider them.

JavaFX : How to close a sub window without getting focus on main window

JavaFX : How to manage the z-index of stages

Sai Dandem
  • 8,229
  • 11
  • 26
  • i might end up using a combination of the two : window popups for simple tooltips, context menus... popups that show only one at a time and will be closed manually or with autohide, and integrate other dialogues into the main window, thanks for the input – SDIDSA Oct 26 '21 at 02:13