JOptionPane.showConfirmDialog popup (Y/N dialogues) blocks accessing other windows of the same application. (needless to mention I know it is the nature of this dialogue to bock other windows, however I dont want it for this app).
In an application I open several jframes in each an image is loaded. Then at the end I ask user whether he/she wants the images to be saved or not. but the user has no access to go back and look at those windows as the JOptionPane.showConfirmDialog does not allow it. How can I set up JOptionPane.showConfirmDialog so that I still have access to the underneath windows?
The JOptionPane dialogs are "modal" which means they intentionally block other windows, forcing the user to make a decision before continuing.
Try JDialog instead and setModal() to false.
How can I set up JOptionPane.showConfirmDialog so that I still have access to the underneath windows?
Read the JOptionPane API. It shows you how to manually create and display the option pane. Since you have direct access to the dialog used and you can make it non-modal.
Related
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?
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'm learning the NetBeans Platform and I've gone through a few tutorials and started working on a app. I've implemented the login tutorial with some changes which include 3 levels of access for a text editing application. The access levels are User, Admin, and None. Based on access level different options will be available. If the user has None, then I want to stop the window from opening and instead present a dialog indicating they don't have permission to use the module. I can't figure out how to keep the window from loading. The permissions check is within the top component constructor but I don't know how to make the window self-close.
I tried doing an immediate return from the constructor but that leaves an empty tab in the editor area. I've tried this.close(), variations on trying to get the WindowManager, etc., with no luck.
How can I make the window either not open or close immediately?
Call this.close() in the componentActivated() method of the top component. Make sure to call super.componentActivated(); before calling this.close()
I've set my program to appear in the system tray by doing what Oracle told to do. My first question is about the icon. I have a lot of programs in the system tray and mine is hidden. Can I make it to show in the bar without needing to click the arrow in the tray?
I also figured out that I can display a message by calling trayIcon.displayMessage(title, content, icon). I wonder if I can change the outlook of the balloon in the way Skype has done it.
Or do I need to use someting else do display a message? It should appear always in the front of all the applications and it shouldn't hinder other applications. For example if the user is playing a game, the information dialog shouldn't steal the focus from mouse and keyboard.
No you cant change the style of the baloon using the java systray mechanism. Skype doesnt use the java mechanism to show the systray. It is the systems task to style and display the baloon.
To show your icon, it is a windows configuration - when you click the arrow, there is a "customize" link, where you can configure which icons are displayed.
If you want to influence the style of the window, you need to implement your custom Frame that feels like and is positioned like a systray info window. And you would not use the Tray classes.
Concerning your question regarding skinning. The SystemTray displayMessage balloon can not be customized in any way.
My Java application sometimes stays at system tray, just like MSN messenger does. I need popup a window to display some formated texts. Sometimes there is more than 1 message entry. I need to display them all.
I am new to jave Swing/GUI.
Anyone has idea or experience on this?
I haven't had the opportunity to work with the Java system tray functionality yet, but you might be interested in reading this overview.
One particular section that appears to describe what you want is this:
Finally, if you wish to casually notify the user of a change in application status using a tooltip from the tray icon, use the displayMessage() method. This method displays a popup message near the tray icon, which will disappear after a time or if the user clicks on it. Clicking on the message may trigger an ActionEvent, depending on the platform.
That sounds like it describes what you want to do, but I'm not sure if there are any limitations on it. With that, the SystemTray and TrayIcon classes might be of interest as well, although I'm guessing that you've read them already.
The system tray functionality in Java 6 allows you to do what you want. Namely have an icon there, which your application can then react to. The functionality to show a message bubble is available.
I have found that the display of multiple individual messages varies a lot between platforms, so I would group them together in a time interval and show them together instead of individual bubbles.
Have a look at http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/