I’m going to make an application (in Swing) that uses a tree to visualize a data structure (JTree). A tree will be on the left side of a window. The user will be able to browse a tree. The parameters of every tree node will be displayed on the right side of the window. The example windows will be looking like this
=========================== | tree panel | data panel | | | | | | | | | | ---------------------------
The problem arises when a user wants to change that data. when should I validate them ? The easy approach is to open a new modal dialog (JDialog) and let the user to change this data in it. Validation of data would take place in an ‘ok’ button listener method but this is a little clunky. I would like to allow the user to edit those data right in the data panel. In that case when should I validate them?
Is there a pattern of such solution in Swing?
Or any online tutorial how to do it?
Thanks in advance.
Dialogs are bad.
Immediately discard any complete nonsense input immediately. For instance, typing a letter in the numerical field (use Document filters). Don’t beep. Don’t require any particular commit step. You may have retain partially entered data.