Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36789

Re: Can you lock a dialog and continue?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Can you lock a dialog and continue?
Date Fri, 30 Jun 2017 21:14:13 -0000 (UTC)
Organization A noiseless patient Spider
Lines 56
Message-ID <oj6ev5$9mp$1@dont-email.me> (permalink)
References <34333fbb-4b83-454b-9395-4efaa019e95e@googlegroups.com> <fc1ca100-85e5-49fc-9f28-f961288b34e9@googlegroups.com> <oj68qi$ohv$1@dont-email.me> <c4b02e21-c034-43a5-be42-c5b2d5276a83@googlegroups.com> <oj6cot$55h$2@dont-email.me> <c0a4a596-736b-48a8-8314-ff2282214aab@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 30 Jun 2017 21:14:13 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="8b71cb3011387403b76b0c03b3f1a1af"; logging-data="9945"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BpR2yb2FZbQbewFnaYFKhu8DEOmfnF74="
User-Agent Pan/0.141 (Tarzan's Death; 168b179 git.gnome.org/pan2)
Cancel-Lock sha1:1A/UQYpm9sOheZmul+1u2n+Yxdc=
Xref csiph.com comp.lang.java.programmer:36789

Show key headers only | View raw


On Fri, 30 Jun 2017 13:52:30 -0700, Eric Douglas wrote:

> On Friday, June 30, 2017 at 4:40:44 PM UTC-4, Knute Johnson wrote:
>> 
>> I think you ought to use a modal dialog for this unless you haven't
>> completely described what you are trying to do (or I can't understand
>> what you are up to :-).
>> 
>> 
> What I'm trying to do:  Create a window (using JDialog for every window
> which allows linking to other JDialog and customizing decorations).  Add
> something for user to do (ie a JTextField to type value, a JButton to
> submit value).  They click button, it runs a background process, which
> could take a minute.  While the process is running it displays a popup
> window with a progress bar that tells them it's running, and percentage
> complete if possible.  When the background process finishes getting data
> we want to update the main screen, possibly populating a JTable.  When
> the GUI is finished updating I want to close/hide the popup.
>
I think I'd design it a little differently, but of course ymmv. I would:

- pop up a dialog box to get the user's input

- once you've got their input you don't need the dialog box any more,
  so close it. You don't mention that the user can stop the long-running
  process so I assume that they can't stop it, which means you don't need
  the pop-up any more.

- start the background process (thread)

  - this displays a new window with the progress bar in it,

  - updates the progress bar while the process is running

  - closes the progress window when the process is complete

  - force the main screen to update

  - terminate the thread

If the user CAN stop the background process, I'd not bother with the 
dialog box, but just use a window containing:

 - the user input area
 - the progress bar
 - two JButtons, labelled 'Start' (inactive) and 'Quit' (active)

which would only vanish when the background process has ended. This 
arrangement lets the user quit at any time, but the Start button would 
only become active when the value has been entered.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can you lock a dialog and continue? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 10:35 -0700
  Re: Can you lock a dialog and continue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-30 14:24 -0400
  Re: Can you lock a dialog and continue? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 11:34 -0700
    Re: Can you lock a dialog and continue? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-06-30 14:33 -0500
      Re: Can you lock a dialog and continue? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 13:19 -0700
        Re: Can you lock a dialog and continue? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-06-30 15:35 -0500
          Re: Can you lock a dialog and continue? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 13:56 -0700
        Re: Can you lock a dialog and continue? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-06-30 15:40 -0500
          Re: Can you lock a dialog and continue? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 13:52 -0700
            Re: Can you lock a dialog and continue? Martin Gregorie <martin@address-in-sig.invalid> - 2017-06-30 21:14 +0000
            Re: Can you lock a dialog and continue? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-30 17:19 -0400

csiph-web