Blocking application input without a modal dialog

Hi,
Is it possible to block all input to a Swing application while still having the EDT running? I'd want the effect of opening a modal dialog without showing the dialog itself. This is required in order to wait for a SwingWorker thread to execute.
The API documentation of SwingWorker.get() states that "When you want the SwingWorker to block on the Event Dispatch Thread we recommend that you use a modal dialog." However, I'm using a ProgressMonitor to monitor the progress of the worker which opens its own dialogs, so I don't want any other extra dialogs popping up. If the EDT simply waits for the worker, the ProgressMonitor dialog pops up but does not paint itself.
I guess it might be possible to open an modal dialog that is invisible, but it probably can't be guaranteed to be invisible in all environments and not to show up in window lists.
Is this possible using the normal API, or do I need to duplicate the functionality of ProgressMonitor using an always-open modal dialog (which would seem like quite a waste of code)?
Also, is there any method that could be called at intervals and which would handle any pending EDT events? I've seen this in some other toolkits (for example GTK+), and it would simplify working in the EDT a lot.

Thanks for the comments. Especially the page about the disabled glass pane summarized both methods well.
However, my application may have sevelar application panes and dialogs open that modify the document. Disabling and re-enabling all of them manually would be quite a hassle. Unless somebody can give instructions on replicating the disabling effect of a modal dialog, I guess there are two possibilities left:
1. Using a modal dialog that opens always, even for short tasks.
2. Re-implementing the functionality of ProgressMonitor and blocking the EDT for the 0.5 - 1 seconds while it evaluates whether the task is long enough to open the dialog or not.

Similar Messages

  • Unable to disable input field in modal dialog box

    Hi All, I have a screen typed modal dialog box with a table control.
    I want to disable field input in the table control when some conditions meet.
    I write the following code in the PBO, but it's not working. The group1 has been set.
    LOOP AT SCREEN.
           IF screen-group1 = 'DSP'.
             screen-input = 0.
             MODIFY SCREEN.
           ENDIF.
    ENDLOOP.
    Would anyone help me? Thanks in advance!

    Hi,
    Loop over table control and then modify the table control. Check the below threads for reference:
    enble / disable table control column at runtime.
    Table Control Enable / Disable Row | SCN
    Table Control  Fields Disable. | SCN
    hope this helps u,
    Regards,
    Kiran

  • Block application without visible dialog

    Hi
    I need the same behaviour like an application modal dialog but without showing this dialog on the screen. On Windows I can give it a position outside the visible screen area and there it works for me.
    But not all platforms allow me to move the dialog away from the screen.
    Is there another simple way to block the application for user actions?
    Thanks in advance
    Wolfgang R.

    The problem with blindly killing the terminal is that there may be ongoing shell processes running that will also terminate. Sure, from your script perspective, you know you opened one terminal window and that task has finished, but you don't necessarily know what other terminal/shell processes the user has running, or what they're doing, or whether they're safe to quit.
    The right approach is to query Terminal.app to find out how many windows/shells are running, and what they're doing. Only if there are no (or maybe your one) windows open, or if all the windows are idle is the app safe to quit.
    Using do shell script avoids all those issues. In fact it neither knows nor cares whether Terminal.app is running at all.

  • Modal dialog limiting the mouse pointer and blocking all application

    I wanted to create a modal dialog that blocks all application in my desktop. Only password field be present and exits only if correct password is typed. I also wanted to limit the mouse pointer within the window of the modal dialog. Will that be possible? i have read modality feature of Mustang(beta) and notes there that system modality is not included. Can anybody there give me an idea how to do tricks on blocking all applications of the desktop? I will be much grateful to anybody who could solve this problem. Thnx in advance...

    tnx Sarcommand ..i give up on that, i understand the risk if that feature is included..
    all i wanted is to make an internet cafe client/server that blocks the client's pc interaction if log time is reached.blocking only the keyboard and mouse.
    i have seen so many softwares sets the cursor position within the dialog bounding box only with user and password there. though my other application runs the mouse is still captured on the dialog even the dialog lost focus.
    if that would not be possible I'll just send notification to the client, a dialog that does not block any application.
    now, im going to try if the client can do som action whenever the server sends alert if the client java app is not the focus. i will post next time what hapens.but if you tried already, if u dont mind posting it so others could know it also..
    tnx so much Sarcommand..

  • How to make a dalog process custom events when blocked by modal dialog

    Hi,
    I would like to understand the way modal dialogs block other dialogs so that I can properly solve an issue I'm having with two modal dialogs, one blocking the other.
    I have an application, netbeans platform based, that opens a JDialog, NewDiskDlg, with it's modal property set to true. This dialog is responsible for starting a thread that will process a given number of files, from time to time, depending on some conditions, this thread will send events to the NewDiskDlg.
    When this thread is started, the NewDiskDlg creates a new JDialog, also with the modal property set to true. Both dialogs have the same parent, the main window. And this works as I expected, the second dialog, ActiveScanningDlg, opens on top of the NewDiskDlg and, until the thread stops, the dialog stays visible.
    When the thread stops an event is sent to this two dialogs signaling that the job has been completed, and here is my problem. The second dialog, the one that is visible when the event arrives, receives the event and executes the dispose() method, releasing control to the NewDiskDlg in the back, but the NewDiskDlg does not receive the event and does not process it correctly.
    I understand the no input can be sent to a blocked window, but does that include calling upon the window's methods?
    I've been looking for some help on this but my search terms are not good enough to provide me with any useful information. I've also read the topic on the focus system that is present in the Java Tutorial but I feel that that is not what I should be looking at.
    The following code is a snippet of the important parts that I described:
    NewDiskDlg has the following methods to process the events
        public void readingStarted(ReadingEvent evt) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    scanningDlg.showCentered();
        public void readingFile(ReadingEvent evt) {
            //DO NOTHING
        public void readingStopped(ReadingEvent evt) {
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
            if (!showAgain) {
                dispose();
        public void readingAborted(ReadingEvent evt) {
            JOptionPane.showMessageDialog(this, "", "", JOptionPane.ERROR_MESSAGE);//TODO: i18n on the error messagens
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
        }ActiveScanningDlg processes the events like this:
        public void readingStarted(ReadingEvent evt) {
            //DO NOTHING
        public void readingFile(ReadingEvent evt) {
            jpbReadingProgress.setString(evt.getCurrentFileName());
        public void readingStopped(ReadingEvent evt) {
            Lookup.getDefault().lookup(MediaReader.class).removeListener(this);
            dispose();
        public void readingAborted(ReadingEvent evt) {
            readingStopped(evt);
        }This is an example on how the events are sent:
        private void fireReadingFile(ReadingEvent evt) {
            for (ReadingListener l : listeners) {
                l.readingFile(evt);
        }

    Hi,
    You have to check the Tolerance limits set for the following tolerance keys. In case if any where the limit is breached the systems blocks the Invoice as 'R - Invoice verification'. Please check the limits set for all these keys.
    AP - item amount variance (if you have activated the item check)
    DQ and DW - for Quantity variance
    PP - price variance with the order price
    ST - date variance
    VP - Moving average price variance
    Regards,
    Kathir

  • Hiding Application To System Tray will cause Modal dialog unblock

    I have a JFrame, when I minimize it, it will hide. The user can recall it back by simply double click on its icon, which is created in system tray during application initialization.
    However, I am facing problem when I pop up a modal dialog box. (In Linux)
    When I pop up a modal dialog box, I am expecting setVisible(true) will always being block, until the modal dialog box is closed.
    However, in Linux, user is able to minimize the parent windows, even there is a modal dialog box. During minimization, I have to call JFrame.setVisible(false), in order to hide the application.
    A side effect of calling setVisible(false) for a modal dialog box owner (JFrame), will cause the modal dialog box JDialog.setVisible(true) being unblocked and continue for the next statement.
    How I can prevent this, to ensure the JDialog.setVisible is always blocked, until the JDialog is really closed? Thanks!

    tnx Sarcommand ..i give up on that, i understand the risk if that feature is included..
    all i wanted is to make an internet cafe client/server that blocks the client's pc interaction if log time is reached.blocking only the keyboard and mouse.
    i have seen so many softwares sets the cursor position within the dialog bounding box only with user and password there. though my other application runs the mouse is still captured on the dialog even the dialog lost focus.
    if that would not be possible I'll just send notification to the client, a dialog that does not block any application.
    now, im going to try if the client can do som action whenever the server sends alert if the client java app is not the focus. i will post next time what hapens.but if you tried already, if u dont mind posting it so others could know it also..
    tnx so much Sarcommand..

  • Module Pool - Error message on a Modal Dialog screen with input

    Hello All,
    I have a modal dialog screen which is called on F4 help of a input field. This dialog screen has radio buttons on it to select. On selection, we check if the user is authorized to that option. If not, raise and error message with command MESSAGE msgid.....
    When the error message pops-up and when clicked ok on it, the radio buttons on the modal dialog screen gets disabled. I want to have the modal dialog box to be able to accept the new radio button as input.
    Can anyone please suggest.
    Thanks,
    Smita

    Put all of your Radio buttons in the CHAIN ... ENDCHAIN with one module.
    CHAIN.
        FIELD rb1.
        FIELD rb2.
        FIELD rb3.
        MODULE check_chain ON CHAIN-REQUEST.   "<< implement logic in check_Chain
      ENDCHAIN.
    If you want, you can even disable the options before displaying the screen. Do all necessary checks in the PBO and based on that disable the options.
    Regards,
    Naimesh Patel

  • How to create application toolbar in modal dialog box in selection-screen

    Hi Experts,
    how to create application toolbar in modal dialog box in selection-screen?
    Regards,
    Swapnika

    Hi,
    Check the following link regarding Model dialog box and appication toolbar
    http://help.sap.com/saphelp_nw70/helpdata/en/d1/801b84454211d189710000e8322d00/frameset.htm
    It helps in solving your problem.
    Thanks.
    Ramya.

  • Extracting Modal Dialog - P-track application

    Hi,
    I want to use the modal dialog as found in the P-Tack application (page 200 when you click on contribute status button)
    http://apex.oracle.com/pls/apex/f?p=73267:200: (test/test)
    The current Modal Dialog in theme 26 does not work in IE 7. Tried doing Jquery Modal by creating a region but running into all sorts of trouble.
    I know one can export a theme, how would I extract the region template from here? Couldn't see that option anywhere.
    Any direction appreciated. Cheers.

    My Workaround to make good of current theme 26 Modal in IE 7:
    1) Add the following code in HTML header:
    <script type="text/javascript">
    function openModal3(p_div_id)
    // added - ensures user can open one modal at a time, so one opens, existing one closes
    closeModal();
         //gBackground.fadeIn(100); --> commented out
         gLightbox = jQuery('#' + p_div_id);
         gLightbox.addClass('modalOn');
    </script>and call this instead of openModal().
    its the fadeIn() function that causes issues in IE 7. However this is what makes the modal dialog dissapear when you click on any area of the background. So by commenting out, you will need to add a button to call "closeModal()" to close the Modal dialog.
    Still figuring out how to close it by clicking on the background.
    Edited by: William Wallace on 30/05/2013 21:38

  • Open Hyperlink column in sharepoint list in Modal dialog box without redirecting to any page.

    Please help me to achieve:
    open Hyperlink column in SharePoint list in Modal dialog box without redirecting to any page.

    You can use the JSLink to achieve it:
    link
    [custom.development]

  • How can I control modal dialogs in Applescript without a mouse?

    I am trying to use a Griffin PowerMate button to select between two options in an Applescript modal dialog and cannot seem to figure out how to do this. I can set a default button, but I want the user to select between two options (shifting the highlighted button) via the PowerMate. Does anyone have a suggestion?
    I can program the PowerMate to send/emulate a particular keystroke, but I do not know how to make the standard Applescript dialog respond to a keystroke, only a mouse action. I'm trying to create a mouseless interface.
    In short, I want the dialog respond to "Twist to the left and press the button to select A, Twist to the right and press the button to select B." Thoughts?
    Thank you.

    Your System Preferences > Keyboard Shortcuts > Full Keyboard Access preference will need to be set to "all controls", but it also depends on where the particular button is located in the dialog.  The tab key will highlight the buttons from left to right, shift-tab will highlight the buttons from right to left, and the spacebar will "press" the currently highlighted button.  In addition, the escape key will choose the Cancel button (if there is one), and the return key will choose the default button (if a default has been set the button itself will be lit).

  • Help window blocked when accessed from modal dialog

    Activating my CSH from a modal dialog leaves not only the main frame inactive but the help window as well preventing further navigation in the help.
    Do I have to start the help in a separate JVM earning a load of communication problems or is there an elegant way to circumvent this restriction?
    I'd be happy for comments...
    Holger

    I think the following code will fix the problem. src is the modal dialog and m_broker is your help broker.
    We need the following call otherwise modal dialog won't allow the help dialog to gain focus when clicked on...
    ((DefaultHelpBroker)m_broker).setActivationWindow( src);

  • Swing event queue, modal dialogs, event threads, etc...

    Hey all,
    So I am playing around with the focus manager, swing event thread and event queue, etc. Learned quite a bit. I am also playing around with test automation of our UI, using jfcUnit. I have written a few simple apps to play aorund with record/playback, coding tests, etc. What this thread is about though, is figuring out how modal and non-modal dialogs "take over" the event thread/queue? The reason I ask is, if I put a simple test harness like tool embeded in my app as a separate pop-up modal dialog, and from within it there is a GUI that I can use to select a "Test" to run. Now, when I run this test, jfcUnit needs to run on the main window, not within my non-modal dialog. What I am not sure of, however, is that if by using a non-modal dialog all events will go to the main event thread? I mean, I know if I mouse over my second non-modal frame (spawned from the application frame), that events will trigger for that dialog. I remember reading somewhere that modal dialogs "block" the main event queue, all left over events are given to the newly added event queue (presumably by the modal dialog) and existing left-over events get moved to the event queue. If that is the case, I am curious why events for the "old" queue are moved to the new queue if they were orginally intended for the old queue? I would think a "flush" before adding a new queue would be more appropriate so that the old queue can process all of its intended events.
    Now, I am just about to try this, but I am hoping a non-modal pop-up will not interfere with the jfcUnit running the UI of the main window. I am guessing, however, that it might. How are non-modal dialogs handled in terms of events and the event queue? Is it the same as modal dialogs? Or is there no blockage of the mainwindow event queue? If there is no blockage, than any sort of automation based on relative positions to a window may occur on the non-modal dialog, in which case it's best to hide the non-modal dialog during running of these tests.
    What are your thoughts, or better yet, knowledge of this topic? A decent explanation from a developer standpoint and not from the API's which dont give some of the more detailed info I am seeking is what I am hoping to get out of this.
    Thanks.

    Check this out. First, AWTListener has a LOT of
    different types you can register it for. I ORd all
    them together and when I ran my app, it took almost 30
    minutes for it to show up because of the huge stream
    of events being spit out via System.out. ...Yes, that doesn't surprise me in the least. There's hundreds of events that are fired around, usually unbeknownst to the user for every little thing. Lots of component and container events, in particular.
    Just make sure you OR ( using | not || ) ALL the
    "mask" values you want to watch for. That may be why
    you aren't seeing anything. When I did all that, and
    opened a menu, a ton of events came out.Maybe, I'll try that again, but I did specifically add an ActionEvent mask to get action events, and that should be all I need to get action events on buttons or menu items, and it wasn't getting them for either. It was only getting events on buttons when I used SwingEventMonitor, but not menu items.
    So I don't quite understand enough of the underlying event handling. Although, I suspect it could have something to do with the fact that these are Swing components, not AWT components (which their native peers) and it's pretty clear from AbstractButton (or was it DefaultButtonModel) how ActionEvents are fired, and they don't seem to have any connection to the code that deals with AWTListeners.
    My problem is that I kinda need a way to catch events without having a listener attached directly. Normally, I would have a listener, but there's this situation whereby an action may be triggered before I can get hold of the component to attach my listener to it. Perhaps I can get mouse press/release and just deal with it that way.
    Let me know if you did that and still didn't see what
    you were looking for. After playing with this, I am
    guessing the main reason for AWTListener is to
    register a listener for a specific type of event,
    instead of listening to them all, hence avoiding lots
    of extra overhead. Then again, the main event
    dispatcher must do a decent amount of work to fire off
    events to listeners of specific awt event types.Yes, it's definitely that. There's no point in sending events if no one is listening for it, so it does save some time.
    You are right, popup menus I think are dialogs, I
    don't know for sure, but you can access them via the
    JMenu.getPopupMenu() and JMenu.isPopupShowin().
    However, I am still not getting my test stuff working
    quite right.
    Yes, for menu popups. For a JPopupMenu on a right-click on any component (tree or whatever), I had a need to know about that from any arbitrary application (it's this GU testing app I'm working on), and since the popup menu doesn't belong to any component before it's shown, I couldn't necessarily know about it til it was displayed. I managed to use a combination of HierarchyEvents (using an AWTEventListener) and "component added" ContainerEvents. Not a simple matter, but it seems to work well.

  • Multiple Modal dialogs by clicking multiple times on a button

    I have an application where all dialogs are modal. Clicking on a button opens another dialog box. If I click very quickly three four times, two three dialog box of the same type are opened.
    How to avoid this situation.
    Thanks.

    >
    Java is a little slow with mouse events.Java isn't slow with mouse events, the fact that he's getting multiple dialogs shows this. The real problem is that you need to maintain state of your gui and not let the user do things that you know shouldn't happen. You can't depend on modal dialogs to block all user input. Nor can you depend on the event thread to process events quickly.
    Actually, I've found that the reason that I miss events in my application is because I put a large block of code in the event handler. You really have to put as little code in the event handlers as possiable. This usually means that you should delay all processing until you need to display something. Like not processing a mouse event, just copying the values out of it ( X and Y ) and waiting for a paint call to actually figure out what happened. This keeps your gui more responsive.

  • Bug: Behaves like a modal dialog is open, but I don't see any?!

    I wonder if anyone else has come across this bug with SQLDeveloper. Sometimes when I'm working (it doesnt' seem to be at a specific time) the UI becomes unresponsive to mouse clicks. Everywhere I click results in a windows "bong" noise as though a modal dialog is open and preventing me from interacting with the main window, yet the main window is responsive to keyboard input, and I can use keyboard shortcuts to navigate the menus.
    Oddly enough, if I use keyboard to open a dialog e.g. Alt+H.. About, then I can interact with the dialog using the mouse. Similarly if I press Alt+H to pop open the Help menu (for example) and then click anywhere in the window (including the menu items) then the menu will disappear in response to the click.. But the "bong" is still heard and the UI doesnt respond to whatever was clicked on
    The only solution I have is to save all work and restart the app. Is it a known issue?
    Update: I carried on working with the app using only the keyboard. Some time has passed, and I've switched windows, edited code, copied and pasted stuff and saved. The UI is now again responding to mouse clicks without needing restarting.
    Regards
    cj

    I know what causes that - there's an API in the IDE called "WaitCursor" that blocks interaction with the UI while an operation is happening in the background. It's usually employed in cases where an operation is short enough not to require a progress dialog, but long enough that if it just happened on the UI thread, it would look like the product hung for a few seconds. What you're observing (keyboard keeps working, but mouse just produces beeps) is consistent with the behavior of this API. Something in SQL Developer or the base IDE probably forgot to, or took a very long time to, hide the wait cursor after a background operation.
    Summary: it's probably a bug. A Ctrl+Break thread dump not long after you see it happening would probably help the devs to figure out what's causing it.
    Thanks,
    Brian

Maybe you are looking for

  • Can you please help me how resolved this issue.

    Hi Experts I am trying to connect LDAP by R/3 system. R/3 system connected to LDAP but when I am trying to find and pull the fileds in the "Find in the Directolry" option I am getting below error. LDAPRC 010 another server is referenced. Can you plea

  • Cannot Set Up Exchange Account in Windows 8/8.1 Mail App - Need to turn off SSL

    Hi there, The office I work at is currently running an Exchange 2003 server for mail, and for reasons unknown, it isn't using an SSL certificate.  That will be changing some time in the near future, but as a result, I can't set up an email profile fo

  • Reduce File Size functionality

    Hi,             I want to automate the Reduce File Size functionality available in acrobat in one of my plug-in application. This is because,                       Earlier I used "PDDocSaveWithParams" to set the PDF file version as per user selection

  • I am unable to access the iTunes Store, but all other features of iTunes are normal.

    I always get a message "We could not complete your iTunes Store request.  The host is down.  There was an error in the iTunes Store. Please try again later."  I have downloaded and reinstalled the current version of iTunes (11.0.2 (26) 64 bit) with n

  • Whole system slows drastically when network drive is mounted

    Firstly, I hope I'm asking this in the right place. (I've also asked under the MacBook section, but got no replies - sorry for duplicating the question). I'm using a MacBook with Snow Leopard, a Time Capsule and a 1.5TB USB drive attached to the Time