tags:

views:

79

answers:

3

I have a JCheckBox that should not be checked by the user when a certain other field is empty.

So now I want to have an error popup and then reset the checkbox (I've considered disabling the checkbox, but the connection to the other field is non-obvious, and a tooltip text IMO not visible enough).

What's the correct way to do that in Swing? Through a PropertyVetoException? Where do I throw it and where do I catch it? My first (probably ugly) idea would be to add a ChangeListener that itself shows the popup and resets the value.

Edit: The question is about Nikki (screenshot below), an app I am developing which geotags images and exports them to Google Earth's KMZ format. The checkbox is used to select the images to include in the export. But this requires the images to be gotagged first (which in turn requires either a timestamp, or manual assignment). I don't think this requirement can be made obvious through the UI layout.

alt text

+2  A: 

I would simply disable the check box and add a message explaining why the option is not available. A nice way to show the message is to display a mini exclamation mark next to the check box and put the message in a tooltip.

Poping up an exception often feels wrong because users don't read error messages. For most users an error message popup means that the application did something wrong, in your case it's the normal behavior.

Edit if you insist on letting the check box enabled, another way to show the user that some info is missing would be to flash the missing data. Eg. if latitude and longitude are missing and the user clicks on export, set a red background onto these fields for a just a second. This will clearly show the user what's missing.

In this screen, don't you want to put the mouse over the red circle to understand what's going on?

validation

Guillaume
Users don't read explicit error messages, but they do read tooltips attached to mini exclamation marks with completely non-obvious meaning? Sorry, I don't buy that...
Michael Borgwardt
A: 

The field should simply be allowed to disable the checkbox. If the coupling is unintuitive then the GUI layout may have to be reconsidered.


EDIT: I ran it from your page, and I believe the issue here is that you actually have a third and fourth step in addition to select folder, select images. The third step is validate image, and fourth is select images for export. I think your problem is that this is not clearly conveyed in the current layout, and that reflects in your question.

I would suggest that you create a separate column containing the checkbox for each image, and that THAT checkbox is disabled until the image passes validation (step 3). Perhaps with an explanatory text in the column about why the image hasn't passed yet.

Thorbjørn Ravn Andersen
I don't think this can be fixed through layout; see question edit.
Michael Borgwardt
+1  A: 

I don't think the Export JCheckBox should be disabled at all. Instead, the Export JButton itself should examine the current export list and display any anomalous entries in a way that allows navigation to a chosen photograph. If all entries are correct, Export would proceed as usual.

Addendum: It think you are right to keep the interface as non-modal as possible. My model for this would be unsaved files when exiting an editor or uncommitted changes when closing a project in an IDE.

If that's a status line at the bottom of the window, you might indicate the number of photographs currently selected for export, adding a count if any still need geocoding.

trashgod
Certainly an alternative worth considering. But I'd be a little afraid of frustrating the user by making him go back to "fix" something just when he thought he was going to see results.
Michael Borgwardt
It's an interesting problem. Your site is very nice, BTW.
trashgod
@trashgod: thanks :)
Michael Borgwardt