How can I check the parameters without creating a separate dialog?

I am about to make an application (in Swing) that uses a tree to render a data structure (JTree). The tree will be on the left side of the window. The user will be able to view the tree. The parameters of each tree node will be displayed on the right side of the window. The example windows will look like this:

===========================
| tree panel | data panel |
|            |            |
|            |            |
|            |            |
---------------------------

      

The problem arises when the user wants to change this data. when should i check them? An easy approach is to open a new modal dialog (JDialog) and let the user modify this data in it. Data validation will be done in "ok" mode, but this is a little awkward. I would like to allow the user to edit this data directly in the data pane. In this case, when should I check them?

Is there an example of such a solution in Swing?

Or any online tutorial on how to do this?

Thanks in advance.

+1


source to share


2 answers


Dialogues

The bad ones.



Immediately discard any complete nonsense immediately. For example, enter a letter in a numeric field (use document filters). Do not beep. No specific fixing step is required. You may have saved partially entered data.

+1


source


I'm not really sure what you want, but ..

Perhaps you could add this "ok" button (or "make changes" or whatever) to the data bar and when the button is clicked you will validate the data and save the changes if the changes are valid?

(So ​​there are editable components in the data pane)

Edit: if it wasn't good, could you please clarify a bit:



  • Does the data pane display data for one tree item?
  • What data needs to be changed (and verified)

Anyway, if you want to check the correctness of the changes made to the editing component (like JTextField), you can use for example

0


source







All Articles