Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

how to lock a jcheckbox?

Thread view: 
Scott Steiner - 03 Jul 2005 12:09 GMT
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!
Uwe Seimet - 03 Jul 2005 12:14 GMT
> 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
[quoted text clipped - 4 lines]
> 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.

Signature

-----------------------------------------------------------------------
 Dr. Uwe Seimet                                 http://www.seimet.de

Scott Steiner - 03 Jul 2005 12:54 GMT
> > 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
[quoted text clipped - 7 lines]
> 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
Uwe Seimet - 03 Jul 2005 13:16 GMT
> 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.

Signature

-----------------------------------------------------------------------
 Dr. Uwe Seimet                                 http://www.seimet.de

Andrew Thompson - 03 Jul 2005 13:49 GMT
>> 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
[quoted text clipped - 4 lines]
>> 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

Signature

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

Pete Barrett - 03 Jul 2005 18:36 GMT
>it might take anywhere between 1 second and say 5 seconds, that depends
>on the server response time
[quoted text clipped - 6 lines]
>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
Roedy Green - 04 Jul 2005 04:45 GMT
>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 );

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.