Is it possible to ignore an SWT dialog's modality when it is raised?
The issue is that I have an Eclipse RCP application which can be displayed on multiple (8+ screens) at any given time; there can be a single modal dialog raised somewhere on any of the screens (i.e. a user clicks on the Help->About Eclipse page, which displays a modal dialog) which blocks/freezes the rest of the screens until the user finds it and closes it. This is quite problematic as it can be hidden somewhere among a mess of other GUIs.
Ideally it should be possible to interact with the rest of the GUI dialogs even though there is a modal dialog open somewhere. Is this possible?
The cleanest solution is to set the dialog to be non modal (of course) either when setting its style or by invoking the setBlockOnOpen(false); method on the configureShell(...). Unfortunately this is not an option, as the application uses built in eclipse plugins, which are set to modal by default. Is there a way to set it non blocking after it has been opened?
You can also force the modal dialog into the viewport via shell.forceActive(), however this is an ugly solution as it also brings the root swt window into view. If there is a way to just bring forward the modal dialog without its parent, this would be an ok solution.
SWT.shell is quite limited, but maybe there is some other way to mitigate this issue?
Related
As we all know, when a user double-clicks on a window title bar, that window gets resized to the full available screen size. At least I have seen this happening in Mac OS. Any idea how to capture this event? What should I listen to in my code so that I know that the user has single or double-clicked the Window title?
Don’t try to intercept interactions with Window decorations directly
Don’t try to work with clicks. Handling state changes due to keyboard or window decoration interactions differs between OSes and isn’t a JavaFX function anyway.
Use Stage properties and API instead
Stage has a maximized property (and iconifed), listen for changes on relevant properties. Similarly, there is a full screen mode which is a bit different (see Stage Java doc).
Creating your own window decorations
If you really want complete control, you can use an undecorated stage style and add your own decorations in JavaFX for handling basic window system functions. That way, a lot of the decoration functionality can be handled internally by your app, but I really don’t recommend that. There was an old project named Undecorator which assisted doing this if you wanted to go that route (I don’t advise coding it yourself).
Capturing clicks is a bad idea as #jewelsea mentioned in his comment. The effort in the question was to know why the behavior. Upon research, I found that it is a bug already listed by Oracle - please find below: Each window when double-clicked on the title bar is expected to assume full-screen height and width (Maximised) and on double-clicking title bar again should get back to its previous size. This is not working beyond JDK8 is what I understood from this link. However, on macOS Monterey 12.1 (OpenJDK 17) the window is assuming maximized size on double-clicking the title bar, but, is unable to go back to the previous size when double-clicking again.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232812
I would like to create system modal dialog. I mean a dialog that blocks the entire system screen, not a particular application. So far I found Application modality and Toolkit modality that might be replaced even with manual disabling blocked frames, but still no function to lock the entire screen as in a native application. How can I do this?
Well, so far I found the answer:
There is a note on docs.oracle.com:
Note : The new modality model does not implement a system modality,
which blocks all applications (including Java applications) that are
displayed on the desktop while a modal dialog box is active.
As I can see, I just have to seek different way for my task.
I am making a javafx application and I made the border around it invisible but now I would like to know how to "fake" someone from clicking on the fullscreen button (in Windows the middle button in the right top corner). I know how to make it 100% fullscreen but I just want to know how to "fake" the clicking of the windows fullscreen button.
Thanks.
Solution
I think you refer to a maximize button, and perhaps the stage.setMaximized() method.
Maximized != Full Screen
Setting the stage fullscreen viastage.setFullScreen() is generally a different thing than maximizing a stage. A full screen stage operates in full screen exclusive mode (i.e. no windowing at all, the stage takes over the entire display).
Related
What you seem to be doing is creating an undecorated window (i.e. a window with no default OS window frame and no in-built controls for resizing, title and minimize/maximize/close), but you still want some of the functionality that you would get if the window were decorated (by adding your own custom decoration controls to provide it). For more information on how to tackle that problem, see the related question:
JavaFX entirely customized windows?
In particular, checkout the Undecorator project, which is the defacto standard way of supplying such functionality for JavaFX.
I need to create a non-modal popup dialog, which can be dragged and resized by the user.
This example is great, but is a modal dialog. I don't want to block the user from scrolling the main web page.
Is there any component built in to Wicket that I can use, or do I need to use a Javascript library such as YUI or Dojo?
I'm going to use jQwicket for this, which is a JQuery/Wicket integration library
It has a load of useful components, but the one I can use for this particular case is the DialogWebMarkupContainer component.
JQwicket gives me a fairly painless way of using Javascript, using the Java I know and love. That's as it should be :-)
I'm not entirely sure if I understand your concern with "blocking the user from scrolling the main web page" correctly, but maybe you should look into WiQuery - escpecially this example. These dialogs still let you interact with the underlying page.
Are there any current implementations or frameworks for Java Swing that include functionality for a context-switcher menu?
More detail:
In our application, we have several sub-parts of the application, and only one of them is displayed at once. Presently there are several ways to switch between them, including tool bar buttons and via the View menu. We would like to add another means, that is accessible via a keyboard shortcut. This would bring up a context-switch menu, similar in concept to those available in modern OS'es.
If you press Alt+Tab and release the Tab while still holding down Alt, you will get a little window in the middle of the screen, displaying the various applications that are running at the moment. In Ubuntu, you get a screenshot of each application, plus its window manager icon. In Windows you get the window manager icons, and so on.
I think this is possible. You could apply a transformation to a Graphics option that you pass to each JFrame and have it paint a small version of itself on it. Then take those images and place them on a GlassPane on top of your application. The highlighting of the selected window might be tricky, but I think it would work nicely.