how to lock a jcheckbox?

Discussion in 'Java' started by Scott Steiner, Jul 3, 2005.

  1. hi,

    i have a jframe which has several jcheckboxes on it. when the user
    clicks on a checkbox then some action happens which takes a couple of
    seconds. during this action i set the mouse cursor to an hourglass.
    unfortunately the user can click on other checkboxes during this action
    while the mouse cursor is an hourglass. question: how can i lock all
    other checkboxes during the action so that the user can't click on them
    until the initial action has ended? disabling the other checkboxes isn't
    good since this grays them out which i don't want.

    thx!
     
    Scott Steiner, Jul 3, 2005
    #1
    1. Advertising

  2. Scott Steiner

    Uwe Seimet Guest

    Scott Steiner wrote:

    > i have a jframe which has several jcheckboxes on it. when the user
    > clicks on a checkbox then some action happens which takes a couple of
    > seconds. during this action i set the mouse cursor to an hourglass.
    > unfortunately the user can click on other checkboxes during this action
    > while the mouse cursor is an hourglass. question: how can i lock all
    > other checkboxes during the action so that the user can't click on them
    > until the initial action has ended? disabling the other checkboxes isn't
    > good since this grays them out which i don't want.


    From a user interface point of view, does a user expect a time-consuming
    operation when he clicks on a checkbox? A checkbox may not be the right
    GUI element to use in cases where clicking on it triggers such an operation.
    On the other hand, if you use checkboxes and the user should not click
    on them, then I think you should disable them (gray them out), because
    that's the common method to signal that a GUI object cannot be selected
    in the current context.

    --
    -----------------------------------------------------------------------
    Dr. Uwe Seimet http://www.seimet.de
     
    Uwe Seimet, Jul 3, 2005
    #2
    1. Advertising

  3. Uwe Seimet wrote:
    >
    > Scott Steiner wrote:
    >
    > > i have a jframe which has several jcheckboxes on it. when the user
    > > clicks on a checkbox then some action happens which takes a couple of
    > > seconds. during this action i set the mouse cursor to an hourglass.
    > > unfortunately the user can click on other checkboxes during this action
    > > while the mouse cursor is an hourglass. question: how can i lock all
    > > other checkboxes during the action so that the user can't click on them
    > > until the initial action has ended? disabling the other checkboxes isn't
    > > good since this grays them out which i don't want.

    >
    > From a user interface point of view, does a user expect a time-consuming
    > operation when he clicks on a checkbox?


    it might take anywhere between 1 second and say 5 seconds, that depends
    on the server response time

    > A checkbox may not be the right
    > GUI element to use in cases where clicking on it triggers such an operation.

    [...]

    i thought the checkbox should be best because it represents an on/off
    state which is exactly what i'm trying to represent i.e the checkboxes
    all represent settings which are either on or off
     
    Scott Steiner, Jul 3, 2005
    #3
  4. Scott Steiner

    Uwe Seimet Guest

    Scott Steiner wrote:

    > it might take anywhere between 1 second and say 5 seconds, that depends
    > on the server response time


    Do you ensure this maximum timespan with a timeout? I am just asking
    because I have experienced situations where resolving a hostname takes
    more than 5 seconds and where it took much more than 5 seconds before I
    got a connection refused message from a server.

    > i thought the checkbox should be best because it represents an on/off
    > state which is exactly what i'm trying to represent i.e the checkboxes
    > all represent settings which are either on or off


    I see. Why is there a problem with the user clicking on the other
    checkboxes while an operation is in progress? Does it make sense to have
    the operation running in the background (e.g. another thread), so that
    you can properly react on other checkboxes being clicked on?

    IMHO regardless of how a final solution may look like, I don't think
    checkboxes that may not be clicked on should be enabled. They should
    grayed out, invisible, whatever. Everything else is not compliant with
    any GUI I know.

    --
    -----------------------------------------------------------------------
    Dr. Uwe Seimet http://www.seimet.de
     
    Uwe Seimet, Jul 3, 2005
    #4
  5. On Sun, 03 Jul 2005 14:16:54 +0200, Uwe Seimet wrote:

    > Scott Steiner wrote:
    >
    >> it might take anywhere between 1 second and say 5 seconds, that depends
    >> on the server response time


    Definitely don't have the checkbox invoke the action
    itself, try something different..

    > Do you ensure this maximum timespan with a timeout? I am just asking
    > because I have experienced situations where resolving a hostname takes
    > more than 5 seconds and where it took much more than 5 seconds before I
    > got a connection refused message from a server.
    >
    >> i thought the checkbox should be best because it represents an on/off
    >> state which is exactly what i'm trying to represent i.e the checkboxes
    >> all represent settings which are either on or off

    >

    ....
    > IMHO regardless of how a final solution may look like, I don't think
    > checkboxes that may not be clicked on should be enabled.


    That is a very good point, but if the user would best be
    presented with a boolean element, there might be better,
    more intuitive ways to update the UI and inform the user.
    So..

    Instead of invoking the refresh on checkbox state change, you
    enable a *button* that reads 'Refresh Data' or 'Submit Query'
    or ..whatever it takes to convince the user that a server
    update is required to proceed.

    Once the final set of changes has been made by the user
    (tick this, untick that..) they click the 'Refresh Data'
    button and at that moment you ..
    a) freeze the state of the UI or
    b) pop up a modal dialog/option pane to block input
    and inform 'Processing'.

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Jul 3, 2005
    #5
  6. Scott Steiner

    Pete Barrett Guest

    On Sun, 03 Jul 2005 13:54:38 +0200, Scott Steiner
    <> wrote:

    >it might take anywhere between 1 second and say 5 seconds, that depends
    >on the server response time
    >
    >> A checkbox may not be the right
    >> GUI element to use in cases where clicking on it triggers such an operation.

    >[...]
    >
    >i thought the checkbox should be best because it represents an on/off
    >state which is exactly what i'm trying to represent i.e the checkboxes
    >all represent settings which are either on or off


    What are you doing if the user wants to change 2 settings, and then
    see the results? I don't know the details of your application, of
    course, and that question may not make sense, but I had a similar
    application recently (combo boxes instead of checkboxes, but the
    principle was the same). What I did was to get the data in a separate
    thread in response to changing the combobox selection, but to allow
    the user to change one of the other comboboxes while the download was
    going on. When that happened, the original download was cancelled
    silently, and a new one started with the new settings.

    Pete Barrett
     
    Pete Barrett, Jul 3, 2005
    #6
  7. Scott Steiner

    Roedy Green Guest

    On Sun, 03 Jul 2005 13:09:28 +0200, Scott Steiner
    <> wrote or quoted :

    >during this action i set the mouse cursor to an hourglass.
    >unfortunately the user can click on other checkboxes during this action
    >while the mouse cursor is an hourglass. question: how can i lock all
    >other checkboxes


    setEnabled( false );
    setEnabled( true );

    --
    Bush crime family lost/embezzled $3 trillion from Pentagon.
    Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
    http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

    Canadian Mind Products, Roedy Green.
    See http://mindprod.com/iraq.html photos of Bush's war crimes
     
    Roedy Green, Jul 4, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eefke Gemmeke

    jCheckBox in a Jtable

    Eefke Gemmeke, Dec 15, 2003, in forum: Java
    Replies:
    2
    Views:
    17,469
    Steve W. Jackson
    Dec 17, 2003
  2. Fuzzyman
    Replies:
    3
    Views:
    493
    Andrew MacIntyre
    Dec 5, 2003
  3. Robert Brewer
    Replies:
    0
    Views:
    491
    Robert Brewer
    Dec 5, 2003
  4. k3xji
    Replies:
    7
    Views:
    817
    Gabriel Genellina
    Dec 30, 2008
  5. nano2k

    Application.Lock()/UnLock() or lock(Application)

    nano2k, Jul 23, 2007, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    289
    nano2k
    Aug 9, 2007
Loading...

Share This Page